Documentation ¶
Overview ¶
Package log provides structured logging.
Index ¶
- Variables
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Logfmt(dst *bytes.Buffer, data map[string]interface{}, keyColors ...ansi.Code)
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- type Entry
- type EntryHandler
- type Fields
- type Level
- type Logger
- func (l *Logger) Clone() *Logger
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Panic(args ...interface{})
- func (l *Logger) Panicf(format string, args ...interface{})
- func (l *Logger) Warn(args ...interface{})
- func (l *Logger) Warnf(format string, args ...interface{})
- func (l *Logger) WithFields(fields Fields) *Logger
- type MutexWriter
- type OutputDir
- type OutputText
Constants ¶
This section is empty.
Variables ¶
View Source
var StdLogger = &Logger{ EntryHandler: &OutputText{ Out: Stderr, DisableColors: !isatty.IsTerminal(os.Stderr.Fd()), }, Level: InfoLevel, }
View Source
var Stderr = NewMutexWriter(os.Stderr)
View Source
var Stdout = NewMutexWriter(os.Stdout)
Functions ¶
Types ¶
type EntryHandler ¶
type EntryHandler interface {
Fire(*Entry)
}
func OutputJSON ¶
func OutputJSON(dst io.Writer) EntryHandler
type Logger ¶
type Logger struct { EntryHandler Level Level // contains filtered or unexported fields }
func WithFields ¶
func (*Logger) WithFields ¶
type MutexWriter ¶
type MutexWriter struct {
// contains filtered or unexported fields
}
func NewMutexWriter ¶
func NewMutexWriter(w io.Writer) *MutexWriter
type OutputDir ¶
type OutputDir struct { // Dir is the directory that log files are written to in JSON-line format. Dir string // contains filtered or unexported fields }
type OutputText ¶
OutputText is an entry handler that writes a log entry as human-readable text to Out. The entry handler makes exactly one call to Out.Write for each entry.
func (*OutputText) Fire ¶
func (h *OutputText) Fire(e *Entry)
Click to show internal directories.
Click to hide internal directories.