log

package
v0.0.0-...-a17827a Latest Latest
Warning

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

Go to latest
Published: May 14, 2017 License: GPL-3.0 Imports: 7 Imported by: 19

Documentation

Index

Constants

View Source
const (
	// QUIET hide every information
	QUIET = Verbose(0)

	// CRITICAL hide most informations,
	// only the worst errors are shown
	CRITICAL = Verbose(1)

	// ERROR hide all non-essential informations,
	// only errors are shown
	ERROR = Verbose(2)

	// WARNING show all errors,
	// even thoses who aren't
	WARNING = Verbose(3)

	// INFO show every important steps of the workflow,
	// like server start, stop, update things, ...
	INFO = Verbose(4)

	// REQUEST show the same messages as INFO,
	// but show also the requests made by users
	REQUEST = Verbose(5)

	// DEBUG is the maximum verbosity level,
	// every pieces of useful informations are printed
	DEBUG = Verbose(6)
)

Variables

View Source
var VerboseMapping = map[string]Verbose{
	"quiet":    QUIET,
	"critical": CRITICAL,
	"error":    ERROR,
	"warning":  WARNING,
	"info":     INFO,
	"request":  REQUEST,
	"debug":    DEBUG,
}

VerboseMapping is the translation between the verbose common name and the verbose type

View Source
var VerboseReverseMapping = map[Verbose]string{
	QUIET:    "quiet",
	CRITICAL: "critical",
	ERROR:    "error",
	WARNING:  "warning",
	INFO:     "info",
	REQUEST:  "request",
	DEBUG:    "debug",
}

VerboseReverseMapping is the translation between the verbosity type and the verbose common name

Functions

func Criticalf

func Criticalf(format string, args ...interface{})

Criticalf log critical messages

func Criticalln

func Criticalln(args ...interface{})

Criticalln log critical messages

func Debugf

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

Debugf log debug messages

func Debugln

func Debugln(args ...interface{})

Debugln log debug messages

func ErrorIf

func ErrorIf(err error) error

ErrorIf return and log an error message

func Errorf

func Errorf(format string, args ...interface{})

Errorf log error messages

func Errorln

func Errorln(args ...interface{})

Errorln log error messages

func Infof

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

Infof log info messages

func Infoln

func Infoln(args ...interface{})

Infoln log info messages

func Logf

func Logf(verbose Verbose, callerSkipBeforeReachingHere int, format string, args ...interface{})

Logf is the same function as Logln, the only difference is that the log can be formated

func Logln

func Logln(verbose Verbose, callerSkipBeforeReachingHere int, args ...interface{})

Logln is the base function used for logging, allowing custom prefix and caller skip, logs are not formatted, and a new line will be append

func Requestf

func Requestf(format string, args ...interface{})

Requestf log request messages

func Requestln

func Requestln(args ...interface{})

Requestln log request messages

func SetOutput

func SetOutput(output io.Writer)

SetOutput set logging to a new io.Writer

func SetOutputFile

func SetOutputFile(filename string) (err error)

SetOutputFile set logging to a file instead of the old logger output

func Warningf

func Warningf(format string, args ...interface{})

Warningf log warning messages

func Warningln

func Warningln(args ...interface{})

Warningln log warning messages

Types

type Verbose

type Verbose int

Verbose is the type of all the available verbose

var (

	// Verbosity is the maximum level of message to print/write
	Verbosity Verbose
)

Jump to

Keyboard shortcuts

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