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{}) string
- type Level
- type Log
- type Logger
- type Option
- 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 ¶
WithPrefix appends the given prefix to the existing prefix.
Types ¶
type Log ¶
type Log interface {
Log(...Option) Logger
SimpleLog() SimpleLogger
PrefixedLog(...Option) PrefixedLogger
}
type Logger ¶
type Logger interface {
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{})
SimpleLogger
NewLog(...Option) Logger
NewPrefixedLog(opts ...Option) PrefixedLogger
}
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 ¶ added in v1.1.0
WithCtxExtractor allows setting up of a function to extract values from the context.
func WithFilePath ¶
WithFilePath sets whether the file path is logged or not.
type PrefixedLogger ¶
type PrefixedLogger interface {
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{})
NewLog(...Option) Logger
NewPrefixedLog(opts ...Option) PrefixedLogger
SimpleLogger
}
func NewPrefixedNoopLogger ¶
func NewPrefixedNoopLogger() PrefixedLogger
type SimpleLogger ¶
type SimpleLogger interface {
Print(v ...interface{})
Printf(format string, v ...interface{})
Println(v ...interface{})
}