jsonlog

package
v0.0.0-...-b0b70ea Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int8

Level represents the severity level of a log entry.

const (
	LevelInfo Level = iota
	LevelError
	LevelFatal
	LevelOff
)

func (Level) String

func (l Level) String() string

String translates the level numbers into a human-readable representation.

type Logger

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

func New

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

New returns a Logger that writes to the given destination. Its logs will have a severity level at or above the given value.

func (*Logger) PrintError

func (l *Logger) PrintError(err error, properties map[string]string)

func (*Logger) PrintFatal

func (l *Logger) PrintFatal(err error, properties map[string]string)

func (*Logger) PrintInfo

func (l *Logger) PrintInfo(message string, properties map[string]string)

func (*Logger) Write

func (l *Logger) Write(message []byte) (n int, err error)

Write satisfies the io.Writer interface. Logs written with Write will always be at the ERROR level, and won't have any additional properties.

Jump to

Keyboard shortcuts

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