logger

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogLevel

type LogLevel int8

Level defines log levels.

const (
	// No log
	LogLevel_Disabled LogLevel = iota

	// Very low frequency messages that should always be displayed (such as copyright)
	LogLevel_Show

	// Errors that cause the application to stop
	LogLevel_Fatal

	// Errors that don't stop the app
	LogLevel_Error

	// Alert conditions that not generate an error
	LogLevel_Warning

	// Important details, such as the version of the components when lifting
	LogLevel_Info

	// Important business details, such as the identification of the transaction and the user who carried it out
	LogLevel_Business

	// Details of all the Business request and response exchanged with the outside
	LogLevel_Message

	//  Detailed execution's information
	LogLevel_Debug

	// Detail of executed querys with their input parameters
	LogLevel_Query

	// Maximum level of detail, such as the values returned by the querys, http trace, etc.
	LogLevel_Trace
)

func NewLogLevel

func NewLogLevel(level string) (LogLevel, error)

func (LogLevel) IsLogAllowed

func (me LogLevel) IsLogAllowed(other LogLevel) bool

func (LogLevel) String

func (l LogLevel) String() string

type Logger

type Logger interface {
	//Sets the current log level. (e.g. "debug")
	SetLogLevel(level string) error
	//Sets the log writer. (e.g. os.Stdout)
	SetOutput(w io.Writer)
	//Sets the function to write the log's timestamp. (e.g. time.Now)
	SetTimestampFunc(f func() time.Time)

	//Includes the ref field on the related log msg call
	WithRefID(refID string) Logger

	Show(msg string)
	Showf(msg string, v ...interface{})

	Fatal(err error, msg string)
	Fatalf(err error, msg string, v ...interface{})

	Error(err error, msg string)
	Errorf(err error, msg string, v ...interface{})

	Warn(msg string)
	Warnf(msg string, v ...interface{})

	Info(msg string)
	Infof(msg string, v ...interface{})

	Bus(msg string)
	Busf(msg string, v ...interface{})

	Msg(msg string)
	Msgf(msg string, v ...interface{})

	Dbg(msg string)
	Dbgf(msg string, v ...interface{})

	Qry(msg string)
	Qryf(msg string, v ...interface{})

	Trace(msg string)
	Tracef(msg string, v ...interface{})
}

func NewNoLogLogger

func NewNoLogLogger() Logger

Jump to

Keyboard shortcuts

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