log

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package log provides a level based logger in place of go's standard logger

Index

Constants

View Source
const (
	FTimestamp = 1 << iota
	FShowFile  // Maybe some other time.
)

Log flags

View Source
const (
	TRACE = 10 * iota
	DEBUG
	INFO
	WARN
	ERROR
	CRIT
	PANIC
)

Log levels

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

Logger is a level based logging engine

func New

func New(flags int, output io.Writer, prefix string, minLevel int) *Logger

New creates a new logger with the set options

func (*Logger) Clone

func (l *Logger) Clone() *Logger

Clone duplicates the logger it is run on, returning a clean version that can be modified

func (*Logger) Crit

func (l *Logger) Crit(args ...interface{})

Crit logs the passed data at the Crit level. The passed arguments are run through fmt.Sprintf before logging

func (*Logger) Critf

func (l *Logger) Critf(format string, args ...interface{})

Critf logs the passed data at the Critf level using the format string passed as the first argument to format the message. The passed arguments are run through fmt.Sprintf before logging

func (*Logger) Debug

func (l *Logger) Debug(args ...interface{})

Debug logs the passed data at the Debug level. The passed arguments are run through fmt.Sprintf before logging

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...interface{})

Debugf logs the passed data at the Debugf level using the format string passed as the first argument to format the message. The passed arguments are run through fmt.Sprintf before logging

func (*Logger) Flags

func (l *Logger) Flags() int

Flags is a getter for the flags the logger currently has

func (*Logger) Info

func (l *Logger) Info(args ...interface{})

Info logs the passed data at the Info level. The passed arguments are run through fmt.Sprintf before logging

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...interface{})

Infof logs the passed data at the Infof level using the format string passed as the first argument to format the message. The passed arguments are run through fmt.Sprintf before logging

func (*Logger) MinLevel

func (l *Logger) MinLevel() int

MinLevel is a getter for the minimum log level on the logger

func (*Logger) Panic

func (l *Logger) Panic(args ...interface{})

Panic logs the passed data at the Panic level. The passed arguments are run through fmt.Sprintf before logging

func (*Logger) Panicf

func (l *Logger) Panicf(format string, args ...interface{})

Panicf logs the passed data at the Panicf level using the format string passed as the first argument to format the message. The passed arguments are run through fmt.Sprintf before logging

func (*Logger) Prefix

func (l *Logger) Prefix() string

Prefix is a getter for the prefix the logger currently has

func (*Logger) SetFlags

func (l *Logger) SetFlags(flags int) *Logger

SetFlags is a setter for the logger's flags. It returns the same Logger it was run on for use in call chains

func (*Logger) SetPrefix

func (l *Logger) SetPrefix(prefix string) *Logger

SetPrefix is a setter for the logger's flags. It returns the same Logger it was run on for use in call chains

func (*Logger) Trace

func (l *Logger) Trace(args ...interface{})

Trace logs the passed data at the Trace level. The passed arguments are run through fmt.Sprintf before logging

func (*Logger) Tracef

func (l *Logger) Tracef(format string, args ...interface{})

Tracef logs the passed data at the Tracef level using the format string passed as the first argument to format the message. The passed arguments are run through fmt.Sprintf before logging

func (*Logger) Warn

func (l *Logger) Warn(args ...interface{})

Warn logs the passed data at the Warn level. The passed arguments are run through fmt.Sprintf before logging

func (*Logger) Warnf

func (l *Logger) Warnf(format string, args ...interface{})

Warnf logs the passed data at the Warnf level using the format string passed as the first argument to format the message. The passed arguments are run through fmt.Sprintf before logging

Jump to

Keyboard shortcuts

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