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
- Variables
- func CallFuncName() string
- func CurrentFuncName() string
- func FuncNameCallStack() string
- func GetFileContentType(file string) (string, error)
- func InitLogging()
- func ProcessRequestOutput(caller, operation, url, payload string, req *http.Request)
- func ProcessResponseOutput(caller string, resp *http.Response, result string)
- func SanitizedHeader(inputHeader http.Header) http.Header
- func SetApiLogFunctions(functions string)
- func SetCustomLogger(customLogger *log.Logger)
- func SetLog()
- func SetSkipTags(tags string)
- func TogglePanicEmptyUserAgent(willPanic bool)
- func Unpack(tarFile string) ([]string, string, error)
Constants ¶
const TmpDirPrefix = "govcd"
Variables ¶
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 // OverwriteLog specifies if log file should be overwritten on every run OverwriteLog 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 = "" // PanicEmptyUserAgent will panic if Request header does not have HTTP User-Agent set This // is generally useful in tests and is off by default. PanicEmptyUserAgent bool = false )
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 FuncNameCallStack ¶
func FuncNameCallStack() string
Returns a string containing up to 10 function names from the call stack
func GetFileContentType ¶
GetFileContentType returns the real file type
func ProcessRequestOutput ¶
Logs the essentials of a HTTP request
func ProcessResponseOutput ¶
Logs the essentials of a HTTP response
func SanitizedHeader ¶
SanitizedHeader returns a http.Header with sensitive fields masked
func SetApiLogFunctions ¶
func SetApiLogFunctions(functions string)
Sets the list of functions to include
func SetCustomLogger ¶
func TogglePanicEmptyUserAgent ¶
func TogglePanicEmptyUserAgent(willPanic bool)
TogglePanicEmptyUserAgent allows to enable Panic in test if HTTP User-Agent is missing. This generally is useful in tests and is off by default.
Types ¶
This section is empty.