Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(args ...interface{})
- func DebugF(f func() interface{})
- func DebugJ(typeName string, obj interface{})
- func Error(args ...interface{})
- func ErrorF(f func() interface{})
- func ErrorJ(typeName string, obj interface{})
- func Info(args ...interface{})
- func InfoF(f func() interface{})
- func InfoJ(typeName string, obj interface{})
- func Log(logLevel Level, args ...interface{})
- func LogJ(logLevel Level, typeName string, obj interface{})
- func Reload()
- func SetLogLevel(logLevel string)
- func SetLoggerHooks(hooks []LoggerHook)
- func Trace(args ...interface{})
- func TraceF(f func() interface{})
- func TraceJ(typeName string, obj interface{})
- func Warn(args ...interface{})
- func WarnF(f func() interface{})
- func WarnJ(typeName string, obj interface{})
- type AsyncBlob
- type DefaultLoggerHook
- type FieldMap
- type JsonMsg
- type KKJSONFormatter
- type Level
- type Logger
- type LoggerHook
Constants ¶
View Source
const ( TraceLevel = Level(logrus.TraceLevel) DebugLevel = Level(logrus.DebugLevel) InfoLevel = Level(logrus.InfoLevel) WarnLevel = Level(logrus.WarnLevel) ErrorLevel = Level(logrus.ErrorLevel) )
Variables ¶
View Source
var AsyncWrite = true
View Source
var AsyncWriteChan = make(chan *AsyncBlob)
View Source
var Environment = defaultEnvironment
View Source
var HandOver = false
View Source
var LoggerPath = defaultLoggerPath
View Source
var ReportCaller = true
View Source
var Shutdown = false
Functions ¶
func SetLogLevel ¶
func SetLogLevel(logLevel string)
func SetLoggerHooks ¶
func SetLoggerHooks(hooks []LoggerHook)
Types ¶
type DefaultLoggerHook ¶
type DefaultLoggerHook struct { }
func (*DefaultLoggerHook) Debug ¶
func (h *DefaultLoggerHook) Debug(args ...interface{})
func (*DefaultLoggerHook) Error ¶
func (h *DefaultLoggerHook) Error(args ...interface{})
func (*DefaultLoggerHook) Info ¶
func (h *DefaultLoggerHook) Info(args ...interface{})
func (*DefaultLoggerHook) Trace ¶
func (h *DefaultLoggerHook) Trace(args ...interface{})
func (*DefaultLoggerHook) Warn ¶
func (h *DefaultLoggerHook) Warn(args ...interface{})
type FieldMap ¶
type FieldMap map[fieldKey]string
FieldMap allows customization of the key names for default fields.
type JsonMsg ¶
type JsonMsg struct { Type string `json:"type,omitempty"` Data interface{} `json:"data,omitempty"` }
func NewJsonMsg ¶
func SimpleJsonMsg ¶
func SimpleJsonMsg(data interface{}) *JsonMsg
type KKJSONFormatter ¶
type KKJSONFormatter struct { // TimestampFormat sets the format used for marshaling timestamps. TimestampFormat string // DisableTimestamp allows disabling automatic timestamps in output DisableTimestamp bool // DataKey allows users to put all the log entry parameters into a nested dictionary at a given key. DataKey string // FieldMap allows users to customize the names of keys for default fields. // As an example: // formatter := &JSONFormatter{ // FieldMap: FieldMap{ // FieldKeyTime: "@timestamp", // FieldKeyLevel: "@level", // FieldKeyMsg: "@message", // FieldKeyFunc: "@caller", // }, // } FieldMap FieldMap // CallerPrettyfier can be set by the user to modify the content // of the function and file keys in the json data when ReportCaller is // activated. If any of the returned value is the empty string the // corresponding key will be removed from json fields. CallerPrettyfier func(*runtime.Frame) (function string, file string) // PrettyPrint will indent all json logs PrettyPrint bool }
JSONFormatter formats logs into parsable json
type Level ¶
func GetLogLevel ¶
func GetLogLevel() Level
type Logger ¶
type Logger interface { Trace(args ...interface{}) Debug(args ...interface{}) Info(args ...interface{}) Warn(args ...interface{}) Error(args ...interface{}) }
type LoggerHook ¶
type LoggerHook interface { Logger }
Click to show internal directories.
Click to hide internal directories.