Documentation ¶
Index ¶
- Constants
- Variables
- func ClearLoggerRegexp()
- func EnterTestMode(logLevel ...LogLevel)
- func Init(c *Config)
- func SetLoggerRegexp(pattern string, level LogLevel) error
- type BaseLogger
- type Codec
- type Config
- type IOSink
- type JsonCodec
- type JsonPrettifier
- type L
- type LogLevel
- type Logger
- func (l *Logger) Copy() (rv *Logger)
- func (l *Logger) Debug(m string)
- func (l *Logger) Debug1(m string)
- func (l *Logger) Debug1d(d map[string]interface{}, m string)
- func (l *Logger) Debug1df(d map[string]interface{}, f string, a ...interface{})
- func (l *Logger) Debug1f(f string, a ...interface{})
- func (l *Logger) Debug2(m string)
- func (l *Logger) Debug2d(d map[string]interface{}, m string)
- func (l *Logger) Debug2df(d map[string]interface{}, f string, a ...interface{})
- func (l *Logger) Debug2f(f string, a ...interface{})
- func (l *Logger) Debugd(d map[string]interface{}, m string)
- func (l *Logger) Debugdf(d map[string]interface{}, f string, a ...interface{})
- func (l *Logger) Debugf(f string, a ...interface{})
- func (l *Logger) Error(m string)
- func (l *Logger) Errord(d map[string]interface{}, m string)
- func (l *Logger) Errordf(d map[string]interface{}, f string, a ...interface{})
- func (l *Logger) Errorf(f string, a ...interface{})
- func (l *Logger) Fatal(m string)
- func (l *Logger) Fatald(d map[string]interface{}, m string)
- func (l *Logger) Fataldf(d map[string]interface{}, f string, a ...interface{})
- func (l *Logger) Fatalf(f string, a ...interface{})
- func (l *Logger) Get(k string) (rv interface{})
- func (l *Logger) Info(m string)
- func (l *Logger) Infod(d map[string]interface{}, m string)
- func (l *Logger) Infodf(d map[string]interface{}, f string, a ...interface{})
- func (l *Logger) Infof(f string, a ...interface{})
- func (l *Logger) Log(x LogLevel, m string, d map[string]interface{})
- func (l *Logger) Set(k string, v interface{})
- func (l *Logger) Warn(m string)
- func (l *Logger) Warnd(d map[string]interface{}, m string)
- func (l *Logger) Warndf(d map[string]interface{}, f string, a ...interface{})
- func (l *Logger) Warnf(f string, a ...interface{})
- type Record
- type RecordTimestamp
- type Sink
- type Syslog
- type TestingSink
Constants ¶
View Source
const ( EXCLUDE_NONE = 0 EXCLUDE_LEVEL = 1 << (iota - 1) EXCLUDE_TIMESTAMP EXCLUDE_FILE EXCLUDE_LINE EXCLUDE_METHOD EXCLUDE_DATA EXCLUDE_MESSAGE )
View Source
const ( MaxMessageSize = 1024 * 3 TruncatePostfix = "..." )
Variables ¶
View Source
var ( LOG_OFF = defineLogLevel("off", 0) LOG_FATAL = defineLogLevel("fatal", 1) LOG_ERROR = defineLogLevel("error", 5) LOG_WARN = defineLogLevel("warn", 10) LOG_INFO = defineLogLevel("info", 15) LOG_DEBUG = defineLogLevel("debug", 16) LOG_DEBUG1 = defineLogLevel("debug1", 17) LOG_DEBUG2 = defineLogLevel("debug2", 18) LOG_ALL = defineLogLevel("all", 30) )
Functions ¶
func ClearLoggerRegexp ¶
func ClearLoggerRegexp()
func EnterTestMode ¶
func EnterTestMode(logLevel ...LogLevel)
func SetLoggerRegexp ¶
Types ¶
type BaseLogger ¶
type BaseLogger struct {
// contains filtered or unexported fields
}
func (*BaseLogger) Level ¶
func (l *BaseLogger) Level() LogLevel
type Codec ¶
func NewJsonCodec ¶
func NewJsonCodec() Codec
type IOSink ¶
func NewFileSink ¶
type JsonPrettifier ¶
type JsonPrettifier struct {
// contains filtered or unexported fields
}
func NewJsonPrettifier ¶
func NewJsonPrettifier(flag int) *JsonPrettifier
func (*JsonPrettifier) DecodeJsonLogEntry ¶
func (p *JsonPrettifier) DecodeJsonLogEntry(logEntry string) (*Record, error)
func (*JsonPrettifier) EncodeRecord ¶
func (p *JsonPrettifier) EncodeRecord(record *Record) ([]byte, error)
type Logger ¶
type Record ¶
type Record struct { Timestamp RecordTimestamp `json:"timestamp"` Pid int `json:"process_id"` Source string `json:"source"` Level LogLevel `json:"log_level"` Message string `json:"message"` Data map[string]interface{} `json:"data"` File string `json:"file,omitempty"` Line int `json:"line,omitempty"` Method string `json:"method,omitempty"` }
type RecordTimestamp ¶
type RecordTimestamp float64
func (RecordTimestamp) MarshalJSON ¶
func (t RecordTimestamp) MarshalJSON() ([]byte, error)
type Syslog ¶
func NewSyslogSink ¶
type TestingSink ¶
func GetMeTheGlobalTestSink ¶
func GetMeTheGlobalTestSink() *TestingSink
func NewTestingSink ¶
func NewTestingSink() *TestingSink
func (*TestingSink) AddRecord ¶
func (tSink *TestingSink) AddRecord(record *Record)
func (*TestingSink) Flush ¶
func (tSink *TestingSink) Flush()
func (*TestingSink) GetCodec ¶
func (tSink *TestingSink) GetCodec() Codec
func (*TestingSink) Records ¶
func (tSink *TestingSink) Records() []*Record
func (*TestingSink) SetCodec ¶
func (tSink *TestingSink) SetCodec(codec Codec)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package syslog provides a simple interface to the system log service.
|
Package syslog provides a simple interface to the system log service. |
Click to show internal directories.
Click to hide internal directories.