logging

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAdapter added in v0.1.6

func NewAdapter(logger Logger, level Level) *log.Logger

NewAdapter creates a new Adapter and returns a log.Logger that writes to it. The level controls how the log messages are written to the Mu logger.

Types

type Adapter added in v0.1.6

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

Adapter adapts the Mu logger to the standard library logger.

func (*Adapter) Write added in v0.1.6

func (a *Adapter) Write(b []byte) (int, error)

Write implements the io.Writer interface.

type Level added in v0.1.11

type Level int

Level is the level of logging.

const (
	// DebugLevel is the debug level.
	DebugLevel Level = iota
	// InfoLevel is the info level.
	InfoLevel
	// WarnLevel is the warn level.
	WarnLevel
	// ErrorLevel is the error level.
	ErrorLevel
)

type Logger

type Logger interface {
	// Level returns the logging level.
	Level() Level
	// SetLevel sets the logging level.
	SetLevel(level Level)
	// DPanic logs a panic message and panics in development mode.
	DPanic(args ...interface{})
	// DPanicf logs a panic message with formatting and panics in development mode.
	DPanicf(template string, args ...interface{})
	// DPanicln logs a panic message with a newline and panics in development mode.
	DPanicln(args ...interface{})
	// DPanicw logs a panic message with key-value pairs and panics in development mode.
	DPanicw(msg string, keysAndValues ...interface{})
	// Debug logs a debug message.
	Debug(args ...interface{})
	// Debugf logs a debug message with formatting.
	Debugf(template string, args ...interface{})
	// Debugln logs a debug message with a newline.
	Debugln(args ...interface{})
	// Debugw logs a debug message with key-value pairs.
	Debugw(msg string, keysAndValues ...interface{})
	// Error logs an error message.
	Error(args ...interface{})
	// Errorf logs an error message with formatting.
	Errorf(template string, args ...interface{})
	// Errorln logs an error message with a newline.
	Errorln(args ...interface{})
	// Errorw logs an error message with key-value pairs.
	Errorw(msg string, keysAndValues ...interface{})
	// Fatal logs a fatal message.
	Fatal(args ...interface{})
	// Fatalf logs a fatal message with formatting.
	Fatalf(template string, args ...interface{})
	// Fatalln logs a fatal message with a newline.
	Fatalln(args ...interface{})
	// Fatalw logs a fatal message with key-value pairs.
	Fatalw(msg string, keysAndValues ...interface{})
	// Info logs an info message.
	Info(args ...interface{})
	// Infof logs an info message with formatting.
	Infof(template string, args ...interface{})
	// Infoln logs an info message with a newline.
	Infoln(args ...interface{})
	// Infow logs an info message with key-value pairs.
	Infow(msg string, keysAndValues ...interface{})
	// Panic logs a panic message.
	Panic(args ...interface{})
	// Panicf logs a panic message with formatting.
	Panicf(template string, args ...interface{})
	// Panicln logs a panic message with a newline.
	Panicln(args ...interface{})
	// Panicw logs a panic message with key-value pairs.
	Panicw(msg string, keysAndValues ...interface{})
	// Sync flushes the logger.
	Sync() error
	// Warn logs a warning message.
	Warn(args ...interface{})
	// Warnf logs a warning message with formatting.
	Warnf(template string, args ...interface{})
	// Warnln logs a warning message with a newline.
	Warnln(args ...interface{})
	// Warnw logs a warning message with key-value pairs.
	Warnw(msg string, keysAndValues ...interface{})
	// With creates a child logger and adds structured context to it.
	With(args ...interface{}) Logger
}

Logger is the interface for logging.

func New

func New(opts ...Option) (Logger, error)

New returns a new logger based on zap.

func NewZapLogger

func NewZapLogger(opts ...Option) (Logger, error)

NewZapLogger creates a new zap logger.

type Option added in v0.1.11

type Option func(Logger)

Option is a function that configures a logger.

func WithLevel added in v0.1.11

func WithLevel(level Level) Option

WithLevel returns an option that sets the logging level.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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