jsonlog

package
v0.0.0-...-ba76496 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: GPL-3.0 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 type represents the severity level for an entry log

const (
	LevelInfo Level = iota
	LevelError
	LevelFatal
	LevelOff
)

Initialize constants to represent various severity levels

func (Level) String

func (l Level) String() string

Create and return a human-friendly message for each severity level

type Logger

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

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

func New

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

New() returns a new Logger instance which writes log entries at or above a minimum severity level to a specific output destination.

func (*Logger) PrintError

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

func (*Logger) PrintFatal

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

func (*Logger) PrintInfo

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

func (*Logger) Write

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

Implement the Write method on the Logger type for it to satisfy the io.Writer interface

Jump to

Keyboard shortcuts

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