log

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DebugLevel logs are typically voluminous, and are usually disabled in
	// production.
	DebugLevel = zapcore.DebugLevel
	// InfoLevel is the default logging priority.
	InfoLevel = zapcore.InfoLevel
	// WarnLevel logs are more important than Info, but don't need individual
	// human review.
	WarnLevel = zapcore.WarnLevel
	// ErrorLevel logs are high-priority. If an application is running smoothly,
	// it shouldn't generate any error-level logs.
	ErrorLevel = zapcore.ErrorLevel
	// PanicLevel logs a message, then panics.
	PanicLevel = zapcore.PanicLevel
	// FatalLevel logs a message, then calls os.Exit(1).
	FatalLevel = zapcore.FatalLevel
)

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

Debug uses fmt.Sprint to construct and logger a message.

func Debugf

func Debugf(msg string, args ...interface{})

Debugf uses fmt.Sprintf to logger a templated message.

func Debugw added in v0.0.3

func Debugw(keyvals ...interface{})

Debugw uses key,value to construct and logger a message.

func Error

func Error(args ...interface{})

Error uses fmt.Sprint to construct and logger a message.

func Errorf

func Errorf(msg string, args ...interface{})

Errorf uses fmt.Sprintf to logger a templated message.

func Errorw added in v0.0.3

func Errorw(keyvals ...interface{})

Errorw uses key,value to construct and logger a message.

func Fatal

func Fatal(args ...interface{})

Fatal uses fmt.Sprint to construct and logger a message, then calls os.Exit.

func Fatalf

func Fatalf(msg string, args ...interface{})

Fatalf uses fmt.Sprintf to logger a templated message, then calls os.Exit.

func Fatalw added in v0.0.3

func Fatalw(keyvals ...interface{})

Fatalw uses key,value to construct and logger a message.

func Flush

func Flush() error

Flush flushing any buffered log entries. Applications should take care to call Sync before exiting.

func Info

func Info(args ...interface{})

Info uses fmt.Sprint to construct and logger a message.

func Infof

func Infof(msg string, args ...interface{})

Infof uses fmt.Sprintf to logger a templated message.

func Infow added in v0.0.3

func Infow(keyvals ...interface{})

Infow uses key,value to construct and logger a message.

func Panic

func Panic(args ...interface{})

Panic uses fmt.Sprint to construct and logger a message, then panics.

func Panicf

func Panicf(msg string, args ...interface{})

Panicf uses fmt.Sprintf to logger a templated message, then panics.

func Panicw added in v0.0.3

func Panicw(keyvals ...interface{})

Panicw uses key,value to construct and logger a message.

func Print

func Print(args ...interface{})

Print uses fmt.Sprint to construct and logger a message.

func Printf

func Printf(msg string, args ...interface{})

Printf uses fmt.Sprintf to logger a templated message.

func Printw added in v0.0.3

func Printw(keyvals ...interface{})

Printw uses key,value to construct and logger a message.

func SetConfig added in v0.0.3

func SetConfig(config Config)

func SetDefaultAdapter added in v0.0.3

func SetDefaultAdapter(adapter *Adapter)

func SetDefaultLogger added in v0.0.3

func SetDefaultLogger(logger Logger)

func SetLevel

func SetLevel(name, lvl string)

SetLevel alters the logging level.

func Warn

func Warn(args ...interface{})

Warn uses fmt.Sprint to construct and logger a message.

func Warnf

func Warnf(msg string, args ...interface{})

Warnf uses fmt.Sprintf to logger a templated message.

func Warnw added in v0.0.3

func Warnw(keyvals ...interface{})

Warnw uses key,value to construct and logger a message.

Types

type Adapter added in v0.0.3

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

func Named

func Named(s string) *Adapter

func NewAdapter added in v0.0.3

func NewAdapter(logger Logger, opts ...Option) *Adapter

NewAdapter new a logger adapter.

func (*Adapter) Close added in v0.0.4

func (la *Adapter) Close() error

func (*Adapter) Debug added in v0.0.3

func (la *Adapter) Debug(args ...interface{})

Debug uses fmt.Sprint to construct and logger a message.

func (*Adapter) Debugf added in v0.0.3

func (la *Adapter) Debugf(msg string, args ...interface{})

Debugf uses fmt.Sprintf to logger a templated message.

func (*Adapter) Debugw added in v0.0.3

func (la *Adapter) Debugw(keyvals ...interface{})

Debugw uses key,value to construct and logger a message.

func (*Adapter) Enabled added in v0.0.3

func (la *Adapter) Enabled(l Level) bool

Enabled implements the zapcore.LevelEnabler interface, which allows the AtomicLevel to be used in place of traditional static levels.

func (*Adapter) Error added in v0.0.3

func (la *Adapter) Error(args ...interface{})

Error uses fmt.Sprint to construct and logger a message.

func (*Adapter) Errorf added in v0.0.3

func (la *Adapter) Errorf(msg string, args ...interface{})

Errorf uses fmt.Sprintf to logger a templated message.

func (*Adapter) Errorw added in v0.0.3

func (la *Adapter) Errorw(keyvals ...interface{})

Errorw uses key,value to construct and logger a message.

func (*Adapter) Fatal added in v0.0.3

func (la *Adapter) Fatal(args ...interface{})

Fatal uses fmt.Sprint to construct and logger a message, then calls os.Exit.

func (*Adapter) Fatalf added in v0.0.3

func (la *Adapter) Fatalf(msg string, args ...interface{})

Fatalf uses fmt.Sprintf to logger a templated message, then calls os.Exit.

func (*Adapter) Fatalw added in v0.0.3

func (la *Adapter) Fatalw(keyvals ...interface{})

Fatalw uses key,value to construct and logger a message.

func (*Adapter) Flush added in v0.0.3

func (la *Adapter) Flush() error

Flush flushing any buffered log entries. Applications should take care to call Sync before exiting.

func (*Adapter) Info added in v0.0.3

func (la *Adapter) Info(args ...interface{})

Info uses fmt.Sprint to construct and logger a message.

func (*Adapter) Infof added in v0.0.3

func (la *Adapter) Infof(msg string, args ...interface{})

Infof uses fmt.Sprintf to logger a templated message.

func (*Adapter) Infow added in v0.0.3

func (la *Adapter) Infow(keyvals ...interface{})

Infow uses key,value to construct and logger a message.

func (*Adapter) Level added in v0.0.3

func (la *Adapter) Level() Level

Level returns the minimum enabled log level.

func (*Adapter) Log added in v0.0.4

func (la *Adapter) Log(_ context.Context, level Level, msg string, keyValues ...interface{})

func (*Adapter) Panic added in v0.0.3

func (la *Adapter) Panic(args ...interface{})

Panic uses fmt.Sprint to construct and logger a message, then panics.

func (*Adapter) Panicf added in v0.0.3

func (la *Adapter) Panicf(msg string, args ...interface{})

Panicf uses fmt.Sprintf to logger a templated message, then panics.

func (*Adapter) Panicw added in v0.0.3

func (la *Adapter) Panicw(keyvals ...interface{})

Panicw uses key,value to construct and logger a message.

func (*Adapter) Print added in v0.0.3

func (la *Adapter) Print(args ...interface{})

Print uses fmt.Sprint to construct and logger a message.

func (*Adapter) Printf added in v0.0.3

func (la *Adapter) Printf(msg string, args ...interface{})

Printf uses fmt.Sprintf to logger a templated message.

func (*Adapter) Printw added in v0.0.3

func (la *Adapter) Printw(keyvals ...interface{})

Printw uses key,value to construct and logger a message.

func (*Adapter) SetLevel added in v0.0.3

func (la *Adapter) SetLevel(l Level) *Adapter

SetLevel alters the logging level.

func (*Adapter) Warn added in v0.0.3

func (la *Adapter) Warn(args ...interface{})

Warn uses fmt.Sprint to construct and logger a message.

func (*Adapter) Warnf added in v0.0.3

func (la *Adapter) Warnf(msg string, args ...interface{})

Warnf uses fmt.Sprintf to logger a templated message.

func (*Adapter) Warnw added in v0.0.3

func (la *Adapter) Warnw(keyvals ...interface{})

Warnw uses key,value to construct and logger a message.

type AtomicLevel added in v0.0.4

type AtomicLevel = zap.AtomicLevel

AtomicLevel is an atomically changeable, dynamic logging level. It lets you

type Config

type Config struct {
	DefaultLevel Level            `json:"level" yaml:"level"`
	Named        map[string]Level `json:"named" yaml:"named"`
}

type Level

type Level = zapcore.Level

Level is a logging priority. Higher levels are more important.

type Logger

type Logger interface {
	io.Closer

	// Log logs a message at a given level.
	Log(ctx context.Context, level Level, msg string, keyValues ...interface{})
}

Logger is a logger interface.

var NopLogger Logger = nopLogger{}

NopLogger is a logger that does nothing.

type Option added in v0.0.3

type Option func(*Adapter)

Option is Helper option.

func WithLevel added in v0.0.3

func WithLevel(level Level) Option

WithLevel with log level.

type ZapConfig added in v0.0.3

type ZapConfig struct {
	zap.Config

	Named map[string]Level `json:"named" yaml:"named"`
}

Jump to

Keyboard shortcuts

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