Documentation ¶
Index ¶
- Variables
- func Debug(message interface{}, params ...interface{})
- func DebugContext(ctx context.Context, message interface{}, params ...interface{})
- func Error(message interface{}, params ...interface{})
- func ErrorContext(ctx context.Context, message interface{}, params ...interface{})
- func Fatal(message interface{}, params ...interface{})
- func FatalContext(ctx context.Context, message interface{}, params ...interface{})
- func Info(message interface{}, params ...interface{})
- func InfoContext(ctx context.Context, message interface{}, params ...interface{})
- func Trace(message interface{}, params ...interface{})
- func TraceContext(ctx context.Context, message interface{}, params ...interface{})
- func Warn(message interface{}, params ...interface{})
- func WarnContext(ctx context.Context, message interface{}, params ...interface{})
- func WithPrefix(p string, message interface{}) stringdeprecated
- type Level
- type Log
- type Logger
- type Option
- func FileDepth(d int) Optiondeprecated
- func Prefixed(prefix string) Option
- func WithColors(enabled bool) Option
- func WithCtxExtractor(fn func(ctx context.Context) []interface{}) Optiondeprecated
- func WithCtxMapExtractor(fn func(ctx context.Context) map[string]string) Option
- func WithCtxTraceExtractor(fn func(ctx context.Context) string) Option
- func WithFilePath(enabled bool) Option
- func WithFuncPath(enabled bool) Option
- func WithLevel(level Level) Option
- func WithOutput(o Output) Option
- func WithSkipFrameCount(c int) Option
- func WithStdOut(w io.Writer) Option
- type Output
- type PrefixedLogger
- type SimpleLogger
Constants ¶
This section is empty.
Variables ¶
var Constructor = NewLog(FileDepth(2))
var PrefixedStdLogger = Constructor.PrefixedLog(FileDepth(3))
var StdLogger = Constructor.Log(FileDepth(3))
Functions ¶
func Debug ¶
func Debug(message interface{}, params ...interface{})
Debug logs with DEBUG level using the standard logger.
func DebugContext ¶
DebugContext logs with DEBUG level with context and prefix using the standard logger.
func Error ¶
func Error(message interface{}, params ...interface{})
Error logs with ERROR level using the standard logger.
func ErrorContext ¶
ErrorContext logs with ERROR level with context and prefix using the standard logger.
func Fatal ¶
func Fatal(message interface{}, params ...interface{})
Fatal logs with FATAL level using the standard logger.
func FatalContext ¶
FatalContext logs with FATAL level with context and prefix using the standard logger.
func Info ¶
func Info(message interface{}, params ...interface{})
Info logs with INFO level using the standard logger.
func InfoContext ¶
InfoContext logs with INFO level with context and prefix using the standard logger.
func Trace ¶
func Trace(message interface{}, params ...interface{})
Trace logs with TRACE level using the standard logger.
func TraceContext ¶
TraceContext logs with TRACE level with context and prefix using the standard logger.
func Warn ¶
func Warn(message interface{}, params ...interface{})
Warn logs with WARN level using the standard logger.
func WarnContext ¶
WarnContext logs with WARN level with context and prefix using the standard logger.
func WithPrefix
deprecated
Types ¶
type Log ¶
type Log interface { Log(...Option) Logger SimpleLog() SimpleLogger PrefixedLog(...Option) PrefixedLogger }
type Logger ¶
type Logger interface { SimpleLogger NewLog(...Option) Logger NewPrefixedLog(opts ...Option) PrefixedLogger Fatal(message interface{}, params ...interface{}) Error(message interface{}, params ...interface{}) Warn(message interface{}, params ...interface{}) Debug(message interface{}, params ...interface{}) Info(message interface{}, params ...interface{}) Trace(message interface{}, params ...interface{}) FatalContext(ctx context.Context, message interface{}, params ...interface{}) ErrorContext(ctx context.Context, message interface{}, params ...interface{}) WarnContext(ctx context.Context, message interface{}, params ...interface{}) DebugContext(ctx context.Context, message interface{}, params ...interface{}) InfoContext(ctx context.Context, message interface{}, params ...interface{}) TraceContext(ctx context.Context, message interface{}, params ...interface{}) }
func NewNoopLogger ¶
func NewNoopLogger() Logger
type Option ¶
type Option func(*logOptions)
Option represents a function that does one or more alterations to 'logOptions' inside the logger.
func WithCtxExtractor
deprecated
added in
v1.1.0
func WithCtxMapExtractor ¶ added in v1.3.0
WithCtxMapExtractor allows setting up a function to extract values from the context as a key:value map.
func WithCtxTraceExtractor ¶ added in v1.2.0
WithCtxTraceExtractor allows setting up of a function to extract trace from the context. Default value func(_ context.Context) string{return ""}
func WithFilePath ¶
WithFilePath sets whether the file path is logged or not.
func WithFuncPath ¶ added in v1.2.0
WithFuncPath sets whether the func path is logged or not.
func WithLevel ¶
WithLevel sets the log level.
The log level is used to determine which types of logs are logged depending on the precedence of the log level.
func WithOutput ¶ added in v1.2.0
WithOutput sets the output format for log entries.
func WithSkipFrameCount ¶ added in v1.2.0
WithSkipFrameCount sets the frame count to skip when reading filepath, func path.
type PrefixedLogger ¶
type PrefixedLogger interface { SimpleLogger NewLog(...Option) Logger NewPrefixedLog(opts ...Option) PrefixedLogger Fatal(prefix string, message interface{}, params ...interface{}) Error(prefix string, message interface{}, params ...interface{}) Warn(prefix string, message interface{}, params ...interface{}) Debug(prefix string, message interface{}, params ...interface{}) Info(prefix string, message interface{}, params ...interface{}) Trace(prefix string, message interface{}, params ...interface{}) FatalContext(ctx context.Context, prefix string, message interface{}, params ...interface{}) ErrorContext(ctx context.Context, prefix string, message interface{}, params ...interface{}) WarnContext(ctx context.Context, prefix string, message interface{}, params ...interface{}) DebugContext(ctx context.Context, prefix string, message interface{}, params ...interface{}) InfoContext(ctx context.Context, prefix string, message interface{}, params ...interface{}) TraceContext(ctx context.Context, prefix string, message interface{}, params ...interface{}) }
func NewPrefixedNoopLogger ¶
func NewPrefixedNoopLogger() PrefixedLogger
type SimpleLogger ¶
type SimpleLogger interface { Print(v ...interface{}) Printf(format string, v ...interface{}) Println(v ...interface{}) }