Documentation ¶
Index ¶
- Constants
- Variables
- func Any(key string, value interface{}) zap.Field
- func Array(key string, val zapcore.ArrayMarshaler) zap.Field
- func Binary(key string, val []byte) zap.Field
- func Bool(key string, val bool) zap.Field
- func Boolp(key string, val *bool) zap.Field
- func Bools(key string, bs []bool) zap.Field
- func ByteString(key string, val []byte) zap.Field
- func ByteStrings(key string, bss [][]byte) zap.Field
- func Complex128(key string, val complex128) zap.Field
- func Complex128p(key string, val *complex128) zap.Field
- func Complex128s(key string, nums []complex128) zap.Field
- func Complex64(key string, val complex64) zap.Field
- func Complex64p(key string, val *complex64) zap.Field
- func Complex64s(key string, nums []complex64) zap.Field
- func Duration(key string, val time.Duration) zap.Field
- func Durationp(key string, val *time.Duration) zap.Field
- func Durations(key string, ds []time.Duration) zap.Field
- func Error(err error) zap.Field
- func Errors(key string, errs []error) zap.Field
- func Float32(key string, val float32) zap.Field
- func Float32p(key string, val *float32) zap.Field
- func Float32s(key string, nums []float32) zap.Field
- func Float64(key string, val float64) zap.Field
- func Float64p(key string, val *float64) zap.Field
- func Float64s(key string, nums []float64) zap.Field
- func Inline(val zapcore.ObjectMarshaler) zap.Field
- func Int(key string, val int) zap.Field
- func Int16(key string, val int16) zap.Field
- func Int16p(key string, val *int16) zap.Field
- func Int16s(key string, nums []int16) zap.Field
- func Int32(key string, val int32) zap.Field
- func Int32p(key string, val *int32) zap.Field
- func Int32s(key string, nums []int32) zap.Field
- func Int64(key string, val int64) zap.Field
- func Int64p(key string, val *int64) zap.Field
- func Int64s(key string, nums []int64) zap.Field
- func Int8(key string, val int8) zap.Field
- func Int8p(key string, val *int8) zap.Field
- func Int8s(key string, nums []int8) zap.Field
- func Intp(key string, val *int) zap.Field
- func Ints(key string, nums []int) zap.Field
- func L() *zap.Logger
- func NamedError(key string, err error) zap.Field
- func Namespace(key string) zap.Field
- func NewLogger(cfg Config) *zap.Logger
- func Object(key string, val zapcore.ObjectMarshaler) zap.Field
- func Reflect(key string, val interface{}) zap.Field
- func S() *zap.SugaredLogger
- func SetGlobal(config Config)
- func Skip() zap.Field
- func Stack(key string) zap.Field
- func StackSkip(key string, skip int) zap.Field
- func String(key string, val string) zap.Field
- func Stringer(key string, val fmt.Stringer) zap.Field
- func Stringp(key string, val *string) zap.Field
- func Strings(key string, ss []string) zap.Field
- func Time(key string, val time.Time) zap.Field
- func Timep(key string, val *time.Time) zap.Field
- func Times(key string, ts []time.Time) zap.Field
- func Uint(key string, val uint) zap.Field
- func Uint16(key string, val uint16) zap.Field
- func Uint16p(key string, val *uint16) zap.Field
- func Uint16s(key string, nums []uint16) zap.Field
- func Uint32(key string, val uint32) zap.Field
- func Uint32p(key string, val *uint32) zap.Field
- func Uint32s(key string, nums []uint32) zap.Field
- func Uint64(key string, val uint64) zap.Field
- func Uint64p(key string, val *uint64) zap.Field
- func Uint64s(key string, nums []uint64) zap.Field
- func Uint8(key string, val uint8) zap.Field
- func Uint8p(key string, val *uint8) zap.Field
- func Uint8s(key string, nums []uint8) zap.Field
- func Uintp(key string, val *uint) zap.Field
- func Uintptr(key string, val uintptr) zap.Field
- func Uintptrp(key string, val *uintptr) zap.Field
- func Uintptrs(key string, us []uintptr) zap.Field
- func Uints(key string, nums []uint) zap.Field
- type Config
- type LoggerPool
Constants ¶
View Source
const ( LOGGER_FILE_STDOUT = "stdout" LOGGER_FILE_STDERR = "stderr" LOGGER_ENCODER_JSON = "json" LOGGER_ENCODER_CONSOLE = "console" )
Variables ¶
View Source
var ( // ErrLoggerExists logger is already exists. ErrLoggerExists = errors.New("logger already exists") // ErrLoggerExists logger is not exists. ErrLoggerNotExists = errors.New("logger does not exists") )
Functions ¶
func Complex128 ¶
func Complex128(key string, val complex128) zap.Field
func Complex128p ¶
func Complex128p(key string, val *complex128) zap.Field
func Complex128s ¶
func Complex128s(key string, nums []complex128) zap.Field
Types ¶
type Config ¶
type Config struct { // Filenames filename to storage log, could be stdout, stderr and files. Filenames []string `json:"filename" yaml:"filename"` // MaxSize log file size, if filename is a path to file, default to 100 (mb). MaxSize int `json:"max_size" yaml:"max_size"` // MaxAge log file retain time, if filename is a path to file, default to 0, not retain (day). MaxAge int `json:"max_age" yaml:"max_age"` // MaxBackups max files to storage, if filename is a path to file, , default to 0, not retain. MaxBackups int `json:"max_backups" yaml:"max_backups"` // LocalTime using local time, if filename is a path to file. LocalTime bool `json:"local_time" yaml:"local_time"` // Compress rotated file is compressed, if filename is a path to file. Compress bool `json:"compress" yaml:"compress"` // LogLevel support debug, info, warn, error, dpanic, panic, fatal, do not care uppgercase or lowwercase. LogLevel string `json:"log_level" yaml:"log_level"` // Encoder encoder log format to store or print, support json and console. Encoder string `json:"encoder" yaml:"encoder"` }
Config Logger config.
type LoggerPool ¶
type LoggerPool struct {
// contains filtered or unexported fields
}
LoggerPool is a pool to manager logger for different business.
func NewPool ¶
func NewPool() *LoggerPool
func (*LoggerPool) Get ¶
func (p *LoggerPool) Get(name string) (*zap.Logger, error)
Get get a named logger from pool.
func (*LoggerPool) Remove ¶
func (p *LoggerPool) Remove(name string) error
Remove remove a named logger from pool.
Click to show internal directories.
Click to hide internal directories.