logger

package
v0.0.0-...-034a78d Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Any

func Any(key string, value interface{}) zap.Field

Any takes a key and an arbitrary value and chooses the best way to represent them as a field, falling back to a reflection-based approach only if necessary.

func Error

func Error(err error) zap.Field

Error is shorthand for the common idiom NamedError("error", err).

func Int64

func Int64(key string, val int64) zap.Field

Int64 constructs a field with the given key and value.

func IsTerminal

func IsTerminal(w io.Writer) bool

IsTerminal checks if w is a file and whether it is an interactive terminal session.

func New

func New() *zap.Logger

func Stack

func Stack() zap.Field

Stack constructs a field that stores a stacktrace of the current goroutine under provided key. Keep in mind that taking a stacktrace is eager and expensive (relatively speaking); this function both makes an allocation and takes about two microseconds.

func String

func String(key string, val string) zap.Field

String constructs a field with the given key and value.

func Uint16

func Uint16(key string, val uint16) zap.Field

Uint16 constructs a field with the given key and value.

func Uint32

func Uint32(key string, val uint32) zap.Field

Uint32 constructs a field with the given key and value.

Types

type Config

type Config struct {
	Path         string        `toml:"path"`
	Format       string        `toml:"format"`
	Level        zapcore.Level `toml:"level"`
}

func NewConfig

func NewConfig() Config

NewConfig returns a new instance of Config with defaults.

func (*Config) New

func (c *Config) New() (*zap.Logger, error)

type Logger

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

Logger is wrapper for zap logger with module, it is singleton.

func GetLogger

func GetLogger(module string) *Logger

GetLogger return logger with module name

func (*Logger) Debug

func (l *Logger) Debug(msg string, fields ...zap.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) Error

func (l *Logger) Error(msg string, fields ...zap.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) Info

func (l *Logger) Info(msg string, fields ...zap.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) Warn

func (l *Logger) Warn(msg string, fields ...zap.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.

Jump to

Keyboard shortcuts

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