jsonlog

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: MIT Imports: 7 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug added in v0.1.0

func Debug(msg string, props ...map[string]any)

Debug defaultLogger.Debug

func Err added in v0.1.0

func Err(err error, props ...map[string]any)

Err defaultLogger.Err

func Fatal added in v0.1.0

func Fatal(err error, props ...map[string]any)

Fatal defaultLogger.Fatal

func Info added in v0.1.0

func Info(msg string, props ...map[string]any)

Info defaultLogger.Info

func Trace added in v0.4.17

func Trace(err error, props ...map[string]any)

Trace defaultLogger.Trace

func Write added in v0.1.0

func Write(msg []byte) (int, error)

Write defaultLogger.Write

Types

type Level

type Level int8
const (
	LevelDebug Level = iota
	LevelInfo
	LevelError
	LevelTrace
	LevelFatal
	LevelOff
)

func (Level) String

func (l Level) String() string

String ...

type Logger

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

Logger holds the output destination that the log entries will be written to, the minimum severity level that log entries will be written for, and a mutex for concurrent writes.

func Default

func Default() *Logger

Default write to stdout with the minimum level set to LevelDebug.

func New

func New(out io.Writer, minLevel Level) *Logger

New create a new Logger

func (*Logger) Debug

func (l *Logger) Debug(msg string, props ...map[string]any)

Debug writes a log entry at LevelDebug to the output destination.

func (*Logger) Err

func (l *Logger) Err(err error, props ...map[string]any)

Err writes a log entry at LevelError to the output destination.

func (*Logger) Fatal

func (l *Logger) Fatal(err error, props ...map[string]any)

Fatal writes a log entry at LevelFatal to the output destination and exit 1.

func (*Logger) Info

func (l *Logger) Info(msg string, props ...map[string]any)

Info writes a log entry at LevelInfo to the output destination.

func (*Logger) Trace added in v0.4.17

func (l *Logger) Trace(err error, props ...map[string]any)

Trace writes a log entry at TraceLevel to the output destination.

func (*Logger) Write

func (l *Logger) Write(msg []byte) (int, error)

Write satisfies the io.Writer interface by call writeRaw.

Jump to

Keyboard shortcuts

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