Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogMessageToString ¶
LogMessageToString converts the last two params to Logger.Log to a string, as documented.
func SetMetricsCallback ¶
func SetMetricsCallback(metricsCallback MetricsCallback)
SetMetricsCallback sets sawLogWithSeverity.
This is set up to break a dependency cycle, such that sklog does not depend on metrics2.
Types ¶
type Logger ¶
type Logger interface { // Log sends a log message to a log destination. `depth` indicates the number // of stack frames to skip. (Implementations should call // `skerr.CallStack(2+depth, ...)`, assuming this call is in the Log method // itself, to skip the Log method and skerr.CallStack in addition to `depth` // frames.) `severity` is one of the severity constants. // This method handles both Print-like and Printf-like formatting; `format` // will be the empty string when Print-like formatting is desired. // To support composing Loggers, this method should not automatically die when // severity is Fatal. Log(depth int, severity Severity, format string, args ...interface{}) // Flush sends any log messages that may be buffered or queued to the log // destination before returning. Flush() }
Logger represents a log destination. All methods must be goroutine-safe. All methods must handle all errors, either by ignoring the errors or writing to os.Stderr.
type MetricsCallback ¶
type MetricsCallback func(severity Severity)
metricsCallback should not call any sklog.* methods, to avoid infinite recursion.
type Severity ¶
type Severity int
Severity identifies the sort of log: info, warning etc.
These constants identify the log levels in order of increasing severity.
func AllSeverities ¶
func AllSeverities() []Severity
AllSeverities returns a list of all severities understood by this package.
func (Severity) StackdriverString ¶
StackdriverString returns the name of the severity per https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#LogSeverity