zapper

package module
v0.0.0-...-4f166ec Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Int constructs a field with the given key and value.
	Int = zap.Int
	// String constructs a field with the given key and value.
	String = zap.String

	// Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
	Debug func(msg string, fields ...zapcore.Field)
	// Info logs a message at InfoLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
	Info func(msg string, fields ...zapcore.Field)
	// Warn logs a message at WarnLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
	Warn func(msg string, fields ...zapcore.Field)
	// Error logs a message at ErrorLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
	Error func(msg string, fields ...zapcore.Field)
	// Fatal logs a message at FatalLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
	Fatal func(msg string, fields ...zapcore.Field)

	// Debugf logs a message at DebugLevel. This message corresponds to the format string.
	Debugf func(format string, values ...interface{})
	// Infof logs a message at InfoLevel. This message corresponds to the format string.
	Infof func(format string, values ...interface{})
	// Warnf logs a message at WarnLevel. This message corresponds to the format string.
	Warnf func(format string, values ...interface{})
	// Errorf logs a message at ErrorLevel. This message corresponds to the format string.
	Errorf func(format string, values ...interface{})
	// Fatalf logs a message at FatalLevel. This message corresponds to the format string.
	Fatalf func(format string, values ...interface{})
)

Functions

func InitGlobalLogger

func InitGlobalLogger(config *Config)

InitGlobalLogger initialize global logger

Types

type Config

type Config struct {
	// EnableConsole is a flag for enable console log.
	EnableConsole bool
	// ConsoleFormat is a format for console log.
	ConsoleFormat string
	// ConsoleLevel is a level for console log.
	ConsoleLevel string

	// EnableFile is a flag for enable file log.
	EnableFile bool
	// FileFormat is a format for file log.
	FileFormat string
	// FileLevel is a log level for file log.
	FileLevel string
	// FilePath is a file path for file log.
	FilePath string
	// FileMaxSize is a max size(megabytes) for file log. The Default is 100 megabytes.
	FileMaxSize int
	// FileMaxAge is a max age(days) for file log. The default is not to remove old log files.
	FileMaxAge int
	// FileMaxBackups is a max backup file number for file log. The default is to retain all old log files
	FileMaxBackups int
	// FileLocalTime is a formatting the timestamps for backup files. The default is to use UTC time.
	FileLocalTime bool
	// FileCompress is a compressed flag for file log. The default is false.
	FileCompress bool
}

Config is settings of logger

type Logger

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

Logger is struct for logging.

func GlobalLogger

func GlobalLogger() *Logger

GlobalLogger retrieve global logger

func NewLogger

func NewLogger(config *Config) *Logger

NewLogger builds a Logger

func (*Logger) Debug

func (l *Logger) Debug(msg string, fields ...zapcore.Field)

Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func (*Logger) Debugf

func (l *Logger) Debugf(msg string, keysAndValues ...interface{})

Debugw logs a message at DebugLevel by SugardLogger. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func (*Logger) Error

func (l *Logger) Error(msg string, fields ...zapcore.Field)

Error logs a message at ErrorLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func (*Logger) Errorf

func (l *Logger) Errorf(msg string, keysAndValues ...interface{})

Errorw logs a message at ErrorLevel by SugardLogger. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func (*Logger) Fatal

func (l *Logger) Fatal(msg string, fields ...zapcore.Field)

Fatal logs a message at FatalLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func (*Logger) Fatalf

func (l *Logger) Fatalf(msg string, keysAndValues ...interface{})

Fatalw logs a message at FatalLevel by SugardLogger. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func (*Logger) Info

func (l *Logger) Info(msg string, fields ...zapcore.Field)

Info logs a message at InfoLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func (*Logger) Infof

func (l *Logger) Infof(msg string, keysAndValues ...interface{})

Infow logs a message at InfoLevel by SugardLogger. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func (*Logger) Warn

func (l *Logger) Warn(msg string, fields ...zapcore.Field)

Warn logs a message at WarnLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func (*Logger) Warnf

func (l *Logger) Warnf(msg string, keysAndValues ...interface{})

Warnw logs a message at WarnLevel by SugardLogger. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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