log

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: GPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Ldate         = 1 << iota     // the date in the local time zone: 2009/01/23
	Ltime                         // the time in the local time zone: 01:23:23
	Lmicroseconds                 // microsecond resolution: 01:23:23.123123.  assumes Ltime.
	Llongfile                     // full file name and line number: /a/b/c/d.go:23
	Lshortfile                    // final file name element and line number: d.go:23. overrides Llongfile
	LUTC                          // if Ldate or Ltime is set, use UTC rather than the local time zone
	LstdFlags     = Ldate | Ltime // initial values for the standard logger
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LogLevel

type LogLevel string
const (
	TRACE LogLevel = LogLevel("TRACE")
	DEBUG LogLevel = LogLevel("DEBUG")
	INFO  LogLevel = LogLevel("INFO")
	WARN  LogLevel = LogLevel("WARN")
	ERROR LogLevel = LogLevel("ERROR")
	FATAL LogLevel = LogLevel("FATAL")
)

func LogLevelFromString

func LogLevelFromString(level string) LogLevel

func VerbosityLevelFromString

func VerbosityLevelFromString(verbosity string) LogLevel

func (LogLevel) String

func (l LogLevel) String() string

type LogLevelValue

type LogLevelValue int

type LogRotator

type LogRotator interface {
	IsEnabled() bool
	Hook(msgLen int64) rerrors.Error
	GetDefaultWriter() (io.Writer, bool)
	UpdateCallBack(callback RotationCallBack)
}

func NewLogNoRotator

func NewLogNoRotator(folder *os.File, fileName string, callback RotationCallBack) (LogRotator, error)

func NewLogRotator

func NewLogRotator(folder *os.File, fileName string, maxFileSize int64, maxNoFiles int, callback RotationCallBack) (LogRotator, error)

Returns NEw LogRotator, in case dile size or number of rotations is less or equals to 0 no rotation will be prformed, and the file will increase size, continuously. Please take care to this topic

type Logger

type Logger interface {
	Tracef(format string, in ...interface{})
	Trace(in ...interface{})
	Debugf(format string, in ...interface{})
	Debug(in ...interface{})
	Infof(format string, in ...interface{})
	Info(in ...interface{})
	Warnf(format string, in ...interface{})
	Warn(in ...interface{})
	Errorf(format string, in ...interface{})
	Error(in ...interface{})
	Fatalf(format string, in ...interface{})
	Fatal(in ...interface{})
	Printf(format string, in ...interface{})
	Println(in ...interface{})
	SetVerbosity(verbosity LogLevel)
	GetVerbosity() LogLevel
	Successf(format string, in ...interface{})
	Success(in ...interface{})
	Failuref(format string, in ...interface{})
	Failure(in ...interface{})
	IsAffiliated() bool
	AffiliateTo(l Logger)
	AffiliateLog(affiliateAppName string, level LogLevelValue, in ...interface{})
	AffiliateLogf(affiliateAppName string, level LogLevelValue, format string, in ...interface{})
	AffiliateWrite(affiliateAppName string, buff []byte)
	AddEchoWriter(key string, writer io.Writer)
	RemoveEchoWriter(key string)
}

func NewFileLogger

func NewFileLogger(appName string, logRotator LogRotator, verbosity LogLevel) (Logger, error)

func NewLogger

func NewLogger(appName string, verbosity LogLevel) Logger

type RotationCallBack

type RotationCallBack func()

Jump to

Keyboard shortcuts

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