logging

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 12 Imported by: 11

Documentation

Index

Constants

View Source
const (
	// LevelDebug logs are typically voluminous, and are usually disabled in production.
	LevelDebug = "DEBUG"
	// LevelInfo is the default logging priority.
	LevelInfo = "INFO"
	// LevelWarn logs are more important than Info, but don't need individual human review.
	LevelWarn = "WARN"
	// LevelError logs are high-priority. If an application is running smoothly,
	// it shouldn't generate any error-level logs.
	LevelError = "ERROR"
	// LevelDPanic  logs are particularly important errors. In development the
	// logger panics after writing the message.
	LevelDPanic = "DPANIC"
	// LevelPanic logs a message, then panics.
	LevelPanic = "PANIC"
	// LevelFatal  logs a message, then calls os.Exit(1).
	LevelFatal = "FATAL"
)

Variables

This section is empty.

Functions

func CreateLogger

func CreateLogger(basicConfig *microConf.BasicConfig, logConfig *conf.LogConfig) (*zap.Logger, error)

CreateLogger create a logger

Types

type ILogger

type ILogger interface {
	Debugw(string, ...interface{})
	Infow(string, ...interface{})
	Warnw(string, ...interface{})
	Errorw(string, ...interface{})
	Panicw(string, ...interface{})
	Fatalw(string, ...interface{})

	Panic(args ...interface{})
	Fatal(args ...interface{})
	Error(args ...interface{})
	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})

	Debugf(string, ...interface{})
	Infof(string, ...interface{})
	Warnf(string, ...interface{})
	Errorf(string, ...interface{})
	Fatalf(string, ...interface{})
	Panicf(string, ...interface{})
}

ILogger log interface

type LoggerGroup

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

LoggerGroup is a group of logger, which provide loggers w/ different levels for modules

func CreateLoggerGroup

func CreateLoggerGroup(basicConfig *microConf.BasicConfig, logConfig *conf.LogGroupConfig) (*LoggerGroup, error)

CreateLoggerGroup create a logger group

func (*LoggerGroup) GetLevels

func (l *LoggerGroup) GetLevels() map[string]string

GetLevels return log levels of each module

func (*LoggerGroup) M

func (l *LoggerGroup) M(module string) ILogger

M return the logger for the module, will return logger w/ INFO level if level is not set for the module

func (*LoggerGroup) SetLevel

func (l *LoggerGroup) SetLevel(module, level string)

SetLevel set log level for the module, which can be called in runtime

func (*LoggerGroup) Sync

func (l *LoggerGroup) Sync() error

Sync calls the underlying Core's Sync method

type NoopLogger

type NoopLogger struct{}

NoopLogger logger

func (*NoopLogger) Debug

func (l *NoopLogger) Debug(args ...interface{})

Debug -

func (*NoopLogger) Debugf

func (l *NoopLogger) Debugf(string, ...interface{})

Debugf -

func (*NoopLogger) Debugw

func (l *NoopLogger) Debugw(string, ...interface{})

Debugw -

func (*NoopLogger) Error

func (l *NoopLogger) Error(args ...interface{})

Error -

func (*NoopLogger) Errorf

func (l *NoopLogger) Errorf(string, ...interface{})

Errorf -

func (*NoopLogger) Errorw

func (l *NoopLogger) Errorw(string, ...interface{})

Errorw -

func (*NoopLogger) Fatal

func (l *NoopLogger) Fatal(...interface{})

Fatal print

func (*NoopLogger) Fatalf

func (l *NoopLogger) Fatalf(string, ...interface{})

Fatalf print

func (*NoopLogger) Fatalln

func (l *NoopLogger) Fatalln(...interface{})

Fatalln print

func (*NoopLogger) Fatalw

func (l *NoopLogger) Fatalw(string, ...interface{})

Fatalw -

func (*NoopLogger) Info

func (l *NoopLogger) Info(args ...interface{})

Info -

func (*NoopLogger) Infof

func (l *NoopLogger) Infof(string, ...interface{})

Infof -

func (*NoopLogger) Infow

func (l *NoopLogger) Infow(string, ...interface{})

Infow -

func (*NoopLogger) Panic

func (l *NoopLogger) Panic(...interface{})

Panic print

func (*NoopLogger) Panicf

func (l *NoopLogger) Panicf(string, ...interface{})

Panicf print

func (*NoopLogger) Panicln

func (l *NoopLogger) Panicln(...interface{})

Panicln print

func (*NoopLogger) Panicw

func (l *NoopLogger) Panicw(string, ...interface{})

Panicw -

func (*NoopLogger) Print

func (l *NoopLogger) Print(...interface{})

Print print

func (*NoopLogger) Printf

func (l *NoopLogger) Printf(string, ...interface{})

Printf print

func (*NoopLogger) Println

func (l *NoopLogger) Println(...interface{})

Println print

func (*NoopLogger) Warn

func (l *NoopLogger) Warn(args ...interface{})

Warn -

func (*NoopLogger) Warnf

func (l *NoopLogger) Warnf(string, ...interface{})

Warnf -

func (*NoopLogger) Warnw

func (l *NoopLogger) Warnw(string, ...interface{})

Warnw -

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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