log

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultLogConfig = &LogConfig{"./", "sys.log", "", 300, 1000, false, fileLogger.TRACE}
)

Functions

func AutoInitLoggerWithConfig

func AutoInitLoggerWithConfig()

func GetDefaultLogSingletons

func GetDefaultLogSingletons() *fileLogger.FileLogger

GetDefaultLogSingletons 获取default log单例

func NewLogInstance

func NewLogInstance(config LogConfig) *fileLogger.FileLogger

func SetDefaultLogConfig

func SetDefaultLogConfig(fileDir, fileName, prefix string, logScan int64, logSeq int, level Level, console bool)

logScan:日志检查时间 ,logSeq:日志通道buf数

Types

type EmptyLog

type EmptyLog struct {
}

************************** Empty Implement ****************************

func NewEmptyLogger

func NewEmptyLogger() *EmptyLog

func (*EmptyLog) Debug

func (f *EmptyLog) Debug(v ...interface{})

func (*EmptyLog) Debugf

func (f *EmptyLog) Debugf(format string, v ...interface{})

func (*EmptyLog) Error

func (f *EmptyLog) Error(v ...interface{})

func (*EmptyLog) Errorf

func (f *EmptyLog) Errorf(format string, v ...interface{})

func (*EmptyLog) Fields

func (f *EmptyLog) Fields() Fields

func (*EmptyLog) Info

func (f *EmptyLog) Info(v ...interface{})

func (*EmptyLog) Infof

func (f *EmptyLog) Infof(format string, v ...interface{})

func (*EmptyLog) Prefix

func (f *EmptyLog) Prefix() string

func (*EmptyLog) Print

func (f *EmptyLog) Print(v ...interface{})

func (*EmptyLog) Printf

func (f *EmptyLog) Printf(format string, v ...interface{})

func (*EmptyLog) SetLevel

func (f *EmptyLog) SetLevel(level Level)

func (*EmptyLog) Trace

func (f *EmptyLog) Trace(v ...interface{})

func (*EmptyLog) Tracef

func (f *EmptyLog) Tracef(format string, v ...interface{})

func (*EmptyLog) Warn

func (f *EmptyLog) Warn(v ...interface{})

func (*EmptyLog) Warnf

func (f *EmptyLog) Warnf(format string, v ...interface{})

func (*EmptyLog) WithFields

func (f *EmptyLog) WithFields(fields Fields) FieldsLogger

func (*EmptyLog) WithPrefix

func (f *EmptyLog) WithPrefix(prefix string) FieldsLogger

type FieLog

type FieLog struct {
	Logger *fileLogger.FileLogger
	// contains filtered or unexported fields
}

func NewFieLogger

func NewFieLogger(prefix string, fields Fields, level Level) *FieLog

NewFieLogger 是以default log单例作为instance,所以不仅会受制于本身的log level,也会受制于default log 的log level

func (*FieLog) Debug

func (f *FieLog) Debug(v ...interface{})

func (*FieLog) Debugf

func (f *FieLog) Debugf(format string, v ...interface{})

func (*FieLog) Error

func (f *FieLog) Error(v ...interface{})

func (*FieLog) Errorf

func (f *FieLog) Errorf(format string, v ...interface{})

func (*FieLog) Fields

func (f *FieLog) Fields() Fields

func (*FieLog) Info

func (f *FieLog) Info(v ...interface{})

func (*FieLog) Infof

func (f *FieLog) Infof(format string, v ...interface{})

func (*FieLog) Prefix

func (f *FieLog) Prefix() string

func (*FieLog) Print

func (f *FieLog) Print(v ...interface{})

func (*FieLog) Printf

func (f *FieLog) Printf(format string, v ...interface{})

func (*FieLog) SetLevel

func (f *FieLog) SetLevel(level Level)

func (*FieLog) Trace

func (f *FieLog) Trace(v ...interface{})

func (*FieLog) Tracef

func (f *FieLog) Tracef(format string, v ...interface{})

func (*FieLog) Warn

func (f *FieLog) Warn(v ...interface{})

func (*FieLog) Warnf

func (f *FieLog) Warnf(format string, v ...interface{})

func (*FieLog) WithFields

func (f *FieLog) WithFields(fields Fields) FieldsLogger

func (*FieLog) WithPrefix

func (f *FieLog) WithPrefix(prefix string) FieldsLogger

type Fields

type Fields map[string]interface{}

func (Fields) String

func (f Fields) String() string

func (Fields) WithFields

func (f Fields) WithFields(newFields Fields) Fields

type FieldsLogger

type FieldsLogger interface {
	Print(args ...interface{})
	Printf(format string, args ...interface{})

	Trace(args ...interface{})
	Tracef(format string, args ...interface{})

	Debug(args ...interface{})
	Debugf(format string, args ...interface{})

	Info(args ...interface{})
	Infof(format string, args ...interface{})

	Warn(args ...interface{})
	Warnf(format string, args ...interface{})

	Error(args ...interface{})
	Errorf(format string, args ...interface{})

	WithPrefix(prefix string) FieldsLogger
	Prefix() string

	WithFields(fields Fields) FieldsLogger
	Fields() Fields

	SetLevel(level Level)
}

type Level

type Level byte
const (
	TRACE Level = iota
	DEBUG
	INFO
	WARN
	ERROR
	OFF
)

type LogConfig

type LogConfig struct {
	FileDir  string
	FileName string
	Prefix   string
	LogScan  int64
	LogSeq   int
	Console  bool
	Level    fileLogger.LEVEL
}

Jump to

Keyboard shortcuts

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