kitlog

package
v0.0.0-...-9aade0d Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

README

kitlog

Open source project:

kit

Reference:

Documentation

Index

Constants

View Source
const (
	JsonFormat LogFormat = "json"
	FmtFormat            = "fmt"
	NoFormat             = "no"
)
View Source
const (

	// CallerNum = 1
	CallerNum = 5
)

Variables

This section is empty.

Functions

func Close

func Close() error

func Crit

func Crit(args ...interface{})

func Critf

func Critf(args ...interface{})

func Debug

func Debug(args ...interface{})

Debug debug

func Debugf

func Debugf(args ...interface{})

Debugf debugf log

func Error

func Error(args ...interface{})

func Errorf

func Errorf(args ...interface{})

func Info

func Info(args ...interface{})

Info info log

func Infof

func Infof(args ...interface{})

func Log

func Log(args ...interface{})

func SetGlobalLog

func SetGlobalLog(opt LogOption, format ...LogFormat)

SetGlobalLog is not thread saftly

func SetGlobalLogWithLog

func SetGlobalLogWithLog(logger log.Logger, levelConf ...level.Option)

SetGlobalLogWithLog set global logger with args logger

func Warn

func Warn(args ...interface{})

func Warnf

func Warnf(args ...interface{})

func WrapLogLevel

func WrapLogLevel(levelsSets []string) []level.Option

Types

type KitLogger

type KitLogger struct {
	log.Logger
	// contains filtered or unexported fields
}

KitLogger kit logger

func GlobalLog

func GlobalLog() *KitLogger

GlobalLog global log

func NewKitLogger

func NewKitLogger(opt LogOption, format ...LogFormat) (*KitLogger, error)

NewKitLogger new kit logger

func (*KitLogger) Close

func (gklog *KitLogger) Close() error

Close close the kit logger

type LogFormat

type LogFormat string

LogFormat log format

type LogOption

type LogOption struct {
	// unit in minutes
	SegmentationThreshold int    `toml:"threshold"`
	LogDir                string `toml:"log_dir"`
	LogName               string `toml:"log_name"`
	LogLevel              string `toml:"log_level"`
	Sync                  bool   `toml:"sync"`
}

LogOption log option

type LogWriter

type LogWriter struct {
	*os.File
	// contains filtered or unexported fields
}

func NewLogWriter

func NewLogWriter(opt LogOption) (*LogWriter, error)

func (*LogWriter) Close

func (lw *LogWriter) Close() error

func (*LogWriter) Write

func (lw *LogWriter) Write(p []byte) (n int, err error)

TODO use bufio buffer

Jump to

Keyboard shortcuts

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