Documentation
¶
Overview ¶
Package logger provides a log interface
Index ¶
- func Debug(args ...interface{})
- func Debugf(template string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(template string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(template string, args ...interface{})
- func Info(args ...interface{})
- func Infof(template string, args ...interface{})
- func Init(opts ...Option) error
- func Level() level.Level
- func Log(l level.Level, v ...interface{})
- func Logf(l level.Level, format string, v ...interface{})
- func Trace(args ...interface{})
- func Tracef(template string, args ...interface{})
- func V(lvl level.Level, log Logger) bool
- func Warn(args ...interface{})
- func Warnf(template string, args ...interface{})
- type Helper
- func (h *Helper) Debug(args ...interface{})
- func (h *Helper) Debugf(template string, args ...interface{})
- func (h *Helper) Error(args ...interface{})
- func (h *Helper) Errorf(template string, args ...interface{})
- func (h *Helper) Fatal(args ...interface{})
- func (h *Helper) Fatalf(template string, args ...interface{})
- func (h *Helper) Info(args ...interface{})
- func (h *Helper) Infof(template string, args ...interface{})
- func (h *Helper) Trace(args ...interface{})
- func (h *Helper) Tracef(template string, args ...interface{})
- func (h *Helper) Warn(args ...interface{})
- func (h *Helper) Warnf(template string, args ...interface{})
- func (h *Helper) WithError(err error) *Helper
- func (h *Helper) WithFields(fields map[string]interface{}) *Helper
- type Logger
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Helper ¶
type Helper struct {
Logger
// contains filtered or unexported fields
}
func (*Helper) WithFields ¶
type Logger ¶
type Logger interface {
// Init initialises Options
Init(options ...Option) error
// Options The Logger Options
Options() Options
// Fields set Fields to always be logged
Fields(fields map[string]interface{}) Logger
// Log writes a log entry
Log(level level.Level, v ...interface{})
// Logf writes a formatted log entry
Logf(level level.Level, format string, v ...interface{})
// String returns the Name of logger
String() string
}
Logger is a generic logging interface
var ( // DefaultLogger logger DefaultLogger Logger )
type Option ¶
type Option func(*Options)
Option set Options
func WithCallerSkipCount ¶
WithCallerSkipCount set frame count to skip
func WithFields ¶
WithFields set default Fields for the logger
func WithOutput ¶
WithOutput set default output writer for the logger
type Options ¶
type Options struct {
// The logging Level the logger should log at. default is `InfoLevel`
Level level.Level
// Fields to always be logged
Fields map[string]interface{}
// It's common to set this to a file, or leave it default which is `os.Stderr`
Out io.Writer
// Caller skip frame count for file:line info
CallerSkipCount int
// Alternative Options
Context context.Context
// Name logger Name
Name string
}
Options options
Click to show internal directories.
Click to hide internal directories.