util

package
v2.1.1-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package util provides ancillary functionality to go-vcloud-director library logging.go regulates logging for the whole library. See LOGGING.md for detailed usage

Index

Constants

View Source
const TmpDirPrefix = "govcd"

Variables

View Source
var (
	// All go-vcloud director logging goes through this logger
	Logger *log.Logger

	// Name of the log file
	// activated by GOVCD_LOG_FILE
	ApiLogFileName string = "go-vcloud-director.log"

	// Globally enabling logs
	// activated by GOVCD_LOG
	EnableLogging bool = false

	// Enable logging of passwords
	// activated by GOVCD_LOG_PASSWORDS
	LogPasswords bool = false

	// Enable logging of Http requests
	// disabled by GOVCD_LOG_SKIP_HTTP_REQ
	LogHttpRequest bool = true

	// Enable logging of Http responses
	// disabled by GOVCD_LOG_SKIP_HTTP_RESP
	LogHttpResponse bool = true

	// Sends log to screen. If value is either "stderr" or "err"
	// logging will go to os.Stderr. For any other value it will
	// go to os.Stdout
	LogOnScreen string = ""
)

Functions

func CallFuncName

func CallFuncName() string

Returns the name of the function that called the current function. Used by functions that call processResponseOutput and processRequestOutput

func CurrentFuncName

func CurrentFuncName() string

Returns the name of the current function

func FuncNameCallStack

func FuncNameCallStack() string

Returns a string containing up to 10 function names from the call stack

func InitLogging

func InitLogging()

Initializes default logging values

func ProcessRequestOutput

func ProcessRequestOutput(caller, operation, url, payload string, req *http.Request)

Logs the essentials of a HTTP request

func ProcessResponseOutput

func ProcessResponseOutput(caller string, resp *http.Response, result string)

Logs the essentials of a HTTP response

func SetApiLogFunctions

func SetApiLogFunctions(functions string)

Sets the list of functions to include

func SetCustomLogger

func SetCustomLogger(customLogger *log.Logger)

func SetLog

func SetLog()

initializes logging with known parameters

func SetSkipTags

func SetSkipTags(tags string)

Sets the list of tahs to skip

func Unpack

func Unpack(tarFile string) ([]string, string, error)

Extract files to system tmp dir with name govcd+random number. Created folder with files isn't deleted. Returns extracted files paths in array and path where folder with files created.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL