log

package
v0.0.0-...-938790d Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg ...interface{})

func Debugf

func Debugf(format string, v ...interface{})

func Debugw

func Debugw(msg string, keysAndValues ...interface{})

func Error

func Error(msg ...interface{})

func Errorf

func Errorf(format string, v ...interface{})

func Errorw

func Errorw(msg string, keysAndValues ...interface{})

func Fatal

func Fatal(msg ...interface{})

func Fatalf

func Fatalf(format string, v ...interface{})

func Fatalw

func Fatalw(msg string, keysAndValues ...interface{})

func Info

func Info(msg ...interface{})

func Infof

func Infof(format string, v ...interface{})

func Infow

func Infow(msg string, keysAndValues ...interface{})

func Init

func Init(opts *Options)

Init initializes the global logger with the given options.

func Panic

func Panic(msg ...interface{})

func Panicf

func Panicf(format string, v ...interface{})

func Panicw

func Panicw(msg string, keysAndValues ...interface{})

func Sync

func Sync()

Sync calls the underlying zap.Logger's Sync method, which flushes the cached logs to disk.

func Warn

func Warn(msg ...interface{})

func Warnf

func Warnf(format string, v ...interface{})

func Warnw

func Warnw(msg string, keysAndValues ...interface{})

Types

type KLogger

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

KLogger is a wrapper around zap.SugaredLogger that implements the Logger interface.

func NewLogger

func NewLogger(opts *Options) *KLogger

NewLogger returns a new KLogger with the given options.

func (*KLogger) Debug

func (k *KLogger) Debug(msg ...interface{})

func (*KLogger) Debugf

func (k *KLogger) Debugf(format string, v ...interface{})

func (*KLogger) Debugw

func (k *KLogger) Debugw(msg string, keysAndValues ...interface{})

func (*KLogger) Error

func (k *KLogger) Error(msg ...interface{})

func (*KLogger) Errorf

func (k *KLogger) Errorf(format string, v ...interface{})

func (*KLogger) Errorw

func (k *KLogger) Errorw(msg string, keysAndValues ...interface{})

func (*KLogger) Fatal

func (k *KLogger) Fatal(msg ...interface{})

func (*KLogger) Fatalf

func (k *KLogger) Fatalf(format string, v ...interface{})

func (*KLogger) Fatalw

func (k *KLogger) Fatalw(msg string, keysAndValues ...interface{})

func (*KLogger) Info

func (k *KLogger) Info(msg ...interface{})

func (*KLogger) Infof

func (k *KLogger) Infof(format string, v ...interface{})

func (*KLogger) Infow

func (k *KLogger) Infow(msg string, keysAndValues ...interface{})

func (*KLogger) Panic

func (k *KLogger) Panic(msg ...interface{})

func (*KLogger) Panicf

func (k *KLogger) Panicf(format string, v ...interface{})

func (*KLogger) Panicw

func (k *KLogger) Panicw(msg string, keysAndValues ...interface{})

func (*KLogger) Sync

func (k *KLogger) Sync()

func (*KLogger) Warn

func (k *KLogger) Warn(msg ...interface{})

func (*KLogger) Warnf

func (k *KLogger) Warnf(format string, v ...interface{})

func (*KLogger) Warnw

func (k *KLogger) Warnw(msg string, keysAndValues ...interface{})

type Logger

type Logger interface {
	Debug(msg ...interface{})
	Info(msg ...interface{})
	Warn(msg ...interface{})
	Error(msg ...interface{})
	Panic(msg ...interface{})
	Fatal(msg ...interface{})
	Debugf(format string, v ...interface{})
	Infof(format string, v ...interface{})
	Warnf(format string, v ...interface{})
	Errorf(format string, v ...interface{})
	Panicf(format string, v ...interface{})
	Fatalf(format string, v ...interface{})
	Debugw(msg string, keysAndValues ...interface{})
	Infow(msg string, keysAndValues ...interface{})
	Warnw(msg string, keysAndValues ...interface{})
	Errorw(msg string, keysAndValues ...interface{})
	Panicw(msg string, keysAndValues ...interface{})
	Fatalw(msg string, keysAndValues ...interface{})
	Sync()
}

Logger is a wrapper around zap.Logger that implements the Logger interface.

type Options

type Options struct {
	// DisableCaller option to disable the caller information.
	DisableCaller bool
	// DisableStacktrace option to disable the stacktrace information.
	DisableStacktrace bool
	// DisableLevel option to disable the level information.
	DisableLevel bool
	// Level option to set the log level.
	Level string
	// Format option to set the log format.
	// format can be "json" or "console".
	Format string
	// OutputPaths option to set the log output paths.
	// output paths can be a file path or a directory path.
	OutputPaths []string
}

Options defines the configuration for the logger.

func NewOptions

func NewOptions() *Options

NewOptions returns a new Options instance with default values.

Jump to

Keyboard shortcuts

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