package
2.5.1+incompatible
Repository: https://github.com/signalfx/golib.git
Documentation: pkg.go.dev

# README

golib logging

A logging abstraction. Borrowed from go-kit/log and restructued for a log interface that does not return an error. The original go-kit/log code is covered under MIT (See LICENSE_gokit) with modifications covered under this repositories license file.

Some of go-kit's tests have been copied directly into this repository and renamed as "kit*_test.go".

# Functions

FiltersFromString is a helper that creates regex style filters from a \n separated string of : separated id -> regex pairs.
FromGokit turns a gokit logger into a golib logger.
IfErr is a shorthand that will log an error if err is not nil.
IfErrAndReturn is a shorthand that will log an error if err is not nil and returns the original err.
IfErrWithKeys logs an error with the supplied logger if it is not nil.
IfErrWithKeysAndReturn logs an error with the supplied logger if it is not nil and then returns the original error.
IsDisabled returns true if the wrapped logger implements Disableable (or is nil).
NewChannelLogger creates a ChannelLogger for channels with size buffer.
NewContext creates a context out of a logger.
NewHierarchy creates a Hierarchy type pointer pointing to defaultLogger.
NewJSONLogger creates a new JSON logger.
NewLogfmtLogger returns a logger that encodes keyvals to the Writer in logfmt format.
NewOnePerSecond returns a *RateLimitedLogger that allows one message per second.
ToGokit turns a golib logger into a go-kit logger.

# Constants

LoggingEnv is the env variable that if exported to /dev/null can disable the default logger.

# Variables

DefaultCaller is what you probably want when using a context.
DefaultErrorHandler is the error handler used by default in FromGokit methods.
DefaultLogger is a root hierarchy logger that other packages can point to.
DefaultTimestamp returns the local time as a string.
DefaultTimestampUTC returns local UTC time as a string.
Discard is a logger that does nothing.
Err is the suggested Log() key for errors.
FilterCount is a log key that is the count of current filters.
Msg is the suggested Log() key for messages.
Panic is a logger that always panics.

# Structs

Caller returns line in the stack trace at Depth stack depth.
ChannelLogger creates a logger that sends log messages to a channel.
Context allows users to create a logger that appends key/values to log statements.
Counter will count log statements.
CtxDimensions can propagate log dimensions inside a context object.
ErrorLogLogger turns a gokit logger into a golib logger.
FilterChangeHandler allows changing filters via HTTP calls.
Gate will enable or disable a wrapped logger.
Hierarchy is a type of logger that an atomically point to another logger.
JSONLogger logs out JSON objects to a writer.
LogfmtLogger logs out in logfmt format.
LoggerKit wraps a logger to make it go-kit compliant.
MultiFilter logs to the first filter that passes.
A RateLimitedLogger will disable itself after a Limit number of log messages in a period.
RegexFilter controls logging to only happen to logs that have a dimension that matches all the regex.
Stats describes the filter.
TimeDynamic returns a time.Time() or time string of when the log message happened.
TimeSince logs the time since the start of the program.

# Interfaces

Disableable is an optional interface that a logger can implement to signal it is disabled and should not be sent log messages for optimization reasons.
Dynamic values are evaluated at Log() time, not when they are added to the context.
ErrorHandler can handle errors that various loggers may return.
ErrorHandlingDisableableLogger wraps Logger and ErrorHandler and Disabled.
ErrorHandlingLogger wraps Logger and ErrorHandler.
ErrorLogger is the interface exposed by go-kit.
A Filter controls if logging should happen.
Logger is the minimal interface for logging methods.

# Type aliases

DynamicFunc wraps a function to make it Dynamic.
ErrorHandlerFunc converts a function into a ErrorHandler.
Key is a type that is expected to be the "key" in structured logging key/value pairs.
LoggerFunc converts a function into a Logger.
MultiLogger is a logger that sends to all the wrapped Loggers.