log

package module
v0.0.0-...-4d57f14 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 7 Imported by: 0

README

Log: A Golang Logging Library


  • usage examples on test_examples.go

Documentation

Index

Constants

View Source
const (
	LOGFATAL byte = 1
	LOGERR   byte = 2
	LOGWARN  byte = 3
	LOGINFO  byte = 4
	LOGDEBUG byte = 5
	LOGTRACE byte = 6
)
View Source
const (
	FILENAME_MODE_NONE     byte = 0
	FILENAME_MODE_FILEONLY byte = 1
	FILENAME_MODE_FILEPATH byte = 2
)

Variables

View Source
var (
	ErrInvalidLogLevel = errors.New("log: invalid log level")
	ErrLogFatal        = errors.New("log: error log FATAL")
	ErrLog             = errors.New("log error")
)

Functions

func StrToConst

func StrToConst(lvl string) (byte, error)

func WithFileName

func WithFileName(l *Log) error

func WithFilePath

func WithFilePath(l *Log) error

Types

type CfgFunc

type CfgFunc func(*Log) error

func WithLevel

func WithLevel(level byte) CfgFunc

func WithWriter

func WithWriter(writer io.Writer) CfgFunc

type Log

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

func NewLog

func NewLog(cfgFuncs ...CfgFunc) (*Log, error)

NewLog create a new logger instance

func (*Log) Debug

func (l *Log) Debug(params ...interface{})

Debug prints the debug log

func (*Log) Debugf

func (l *Log) Debugf(fmtstr string, params ...interface{})

Debugf prints the debug log

func (*Log) Err

func (l *Log) Err(params ...interface{})

Err prints the err log

func (*Log) Errf

func (l *Log) Errf(fmtstr string, params ...interface{})

Errf prints the err log

func (*Log) Fatal

func (l *Log) Fatal(params ...interface{})

Fatal prints the fatal log and panics

func (*Log) Fatalf

func (l *Log) Fatalf(fmtstr string, params ...interface{})

Fatalf prints the fatal log and panics

func (*Log) Info

func (l *Log) Info(params ...interface{})

Info prints the info log

func (*Log) Infof

func (l *Log) Infof(fmtstr string, params ...interface{})

Infof prints the info log

func (*Log) Trace

func (l *Log) Trace(params ...interface{})

Trace prints the trace log

func (*Log) Tracef

func (l *Log) Tracef(fmtstr string, params ...interface{})

Tracef prints the trace log

func (*Log) Warn

func (l *Log) Warn(params ...interface{})

Warn prints the warn log

func (*Log) Warnf

func (l *Log) Warnf(fmtstr string, params ...interface{})

Warnf prints the warn log

Jump to

Keyboard shortcuts

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