Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter struct { // URL returns a potentially modified string representation of a request URL. URL func(u *url.URL) string // Header returns a potentially modified set of values for the specified key. // To completely exclude the header key/values return false. Header func(key string, val []string) (bool, []string) // Body returns a potentially modified request/response body. Body func(b []byte) []byte }
Filter defines functions for filtering HTTP request/response content.
type LevelType ¶
type LevelType uint32
LevelType tells a logger the minimum level to log. When code reports a log entry, the LogLevel indicates the level of the log entry. The logger only records entries whose level is at least the level it was told to log. See the Log* constants. For example, if a logger is configured with LogError, then LogError, LogPanic, and LogFatal entries will be logged; lower level entries are ignored.
const ( // LogNone tells a logger not to log any entries passed to it. LogNone LevelType = iota // LogFatal tells a logger to log all LogFatal entries passed to it. LogFatal // LogPanic tells a logger to log all LogPanic and LogFatal entries passed to it. LogPanic // LogError tells a logger to log all LogError, LogPanic and LogFatal entries passed to it. LogError // LogWarning tells a logger to log all LogWarning, LogError, LogPanic and LogFatal entries passed to it. LogWarning // LogInfo tells a logger to log all LogInfo, LogWarning, LogError, LogPanic and LogFatal entries passed to it. LogInfo // LogDebug tells a logger to log all LogDebug, LogInfo, LogWarning, LogError, LogPanic and LogFatal entries passed to it. LogDebug // LogAuth is a special case of LogDebug, it tells a logger to also log the body of an authentication request and response. // NOTE: this can disclose sensitive information, use with care. LogAuth )
func Level ¶
func Level() LevelType
Level returns the value specified in AZURE_GO_AUTOREST_LOG_LEVEL. If no value was specified the default value is LogNone. Custom loggers can call this to retrieve the configured log level.
func ParseLevel ¶
ParseLevel converts the specified string into the corresponding LevelType.
type Writer ¶
type Writer interface { // Writeln writes the specified message with the standard log entry header and new-line character. Writeln(level LevelType, message string) // Writef writes the specified format specifier with the standard log entry header and no new-line character. Writef(level LevelType, format string, a ...interface{}) // WriteRequest writes the specified HTTP request to the logger if the log level is greater than // or equal to LogInfo. The request body, if set, is logged at level LogDebug or higher. // Custom filters can be specified to exclude URL, header, and/or body content from the log. // By default no request content is excluded. WriteRequest(req *http.Request, filter Filter) // WriteResponse writes the specified HTTP response to the logger if the log level is greater than // or equal to LogInfo. The response body, if set, is logged at level LogDebug or higher. // Custom filters can be specified to exclude URL, header, and/or body content from the log. // By default no response content is excluded. WriteResponse(resp *http.Response, filter Filter) }
Writer defines methods for writing to a logging facility.
var Instance Writer
Instance is the default log writer initialized during package init. This can be replaced with a custom implementation as required.