kklogger

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 10 Imported by: 23

Documentation

Index

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 Debug

func Debug(args ...interface{})

func DebugF

func DebugF(f func() interface{})

func DebugJ

func DebugJ(typeName string, obj interface{})

func Error

func Error(args ...interface{})

func ErrorF

func ErrorF(f func() interface{})

func ErrorJ

func ErrorJ(typeName string, obj interface{})

func Info

func Info(args ...interface{})

func InfoF

func InfoF(f func() interface{})

func InfoJ

func InfoJ(typeName string, obj interface{})

func Log

func Log(logLevel Level, args ...interface{})

func LogJ

func LogJ(logLevel Level, typeName string, obj interface{})

func Reload

func Reload()

func SetLogLevel

func SetLogLevel(logLevel string)

func SetLoggerHooks

func SetLoggerHooks(hooks []LoggerHook)

func Trace

func Trace(args ...interface{})

func TraceF

func TraceF(f func() interface{})

func TraceJ

func TraceJ(typeName string, obj interface{})

func Warn

func Warn(args ...interface{})

func WarnF

func WarnF(f func() interface{})

func WarnJ

func WarnJ(typeName string, obj interface{})

Types

type AsyncBlob

type AsyncBlob struct {
	// contains filtered or unexported fields
}

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 NewJsonMsg(typeName string, data interface{}) *JsonMsg

func SimpleJsonMsg

func SimpleJsonMsg(data interface{}) *JsonMsg

func (*JsonMsg) Marshal

func (j *JsonMsg) Marshal() []byte

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

func (*KKJSONFormatter) Format

func (f *KKJSONFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format renders a single log entry

type Level

type Level logrus.Level

func GetLogLevel

func GetLogLevel() Level

func (Level) String

func (l Level) String() string

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL