logger

package
v1.2.31 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: AGPL-3.0 Imports: 4 Imported by: 9

Documentation

Index

Constants

View Source
const (
	// CRITICAL errors
	CRITICAL = iota
	// SEVERE errors
	SEVERE
	// ERROR message
	ERROR
	// WARN for warning messages
	WARN
	// INFO is for informational messages
	INFO
	// DBG for debug messages
	DBG

	// ROTATE log file command
	ROTATE = iota // rotate log file
	// FLUSH log (make sure all messages are processed)
	FLUSH
)

Variables

This section is empty.

Functions

func ColorFormat added in v1.2.1

func ColorFormat(msg *logMsg) string

ColorFormat uses colors for different log levels

func Flush added in v1.1.1

func Flush()

Flush log: make sure all messages are processed.

func GetLogLevel

func GetLogLevel() int

GetLogLevel returns a numeric log level.

func GetLogLevelName

func GetLogLevelName() string

GetLogLevelName returns the current loglevel in human-readable form.

func LogToFile

func LogToFile(filename string) bool

LogToFile starts logging messages to file.

func Printf

func Printf(level int, format string, v ...interface{})

Printf punches formatted logging data for givel level

func Println

func Println(level int, line string)

Println punches logging data for given level.

func Rotate

func Rotate()

Rotate log file.

func SetLogLevel

func SetLogLevel(lvl int)

SetLogLevel sets the logging level from numeric value

func SetLogLevelFromName

func SetLogLevelFromName(name string)

SetLogLevelFromName sets the logging level from symbolic name.

func SimpleFormat added in v1.2.1

func SimpleFormat(msg *logMsg) string

SimpleFormat creates a plain format for log messages

Types

type Formatter added in v1.2.1

type Formatter func(msg *logMsg) string

Formatter function type: convert a log message into a string for output

func UseFormat added in v1.2.1

func UseFormat(f Formatter) Formatter

UseFormat sets a new format processor and returns the old one.

Jump to

Keyboard shortcuts

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