logger

package
v0.1.0-M4 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: Apache-2.0, EPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(format string, v ...interface{})

Debug logs the given formatted message and value, if level is >= DEBUG

func DebugErr

func DebugErr(err error, format string, v ...interface{})

DebugErr logs the given value, formatted message and error, if level is >= DEBUG

func Error

func Error(format string, v ...interface{})

Error logs the given formatted message and value, if level is >= ERROR

func ErrorErr

func ErrorErr(err error, format string, v ...interface{})

ErrorErr logs the given value, formatted message and error, if level is >= ERROR

func Info

func Info(format string, v ...interface{})

Info logs the given formatted message and value, if level is >= INFO

func InfoErr

func InfoErr(err error, format string, v ...interface{})

InfoErr logs the given value, formatted message and error, if level is >= INFO

func IsDebugEnabled

func IsDebugEnabled() bool

IsDebugEnabled returns true if log level is above DEBUG

func IsTraceEnabled

func IsTraceEnabled() bool

IsTraceEnabled returns true if log level is above TRACE

func SetupLogger

func SetupLogger(logConfig *LogConfig, componentPrefix string) (io.WriteCloser, error)

SetupLogger initializes logger with the provided configuration

func Trace

func Trace(format string, v ...interface{})

Trace logs the given formatted message and value, if level is >= TRACE

func TraceErr

func TraceErr(err error, format string, v ...interface{})

TraceErr logs the given value, formatted message and error, if level is >= TRACE

func Warn

func Warn(format string, v ...interface{})

Warn logs the given formatted message and value, if level is >= WARN

func WarnErr

func WarnErr(err error, format string, v ...interface{})

WarnErr logs the given value, formatted message and error, if level is >= WARN

Types

type LogConfig

type LogConfig struct {
	LogFile       string `json:"logFile,omitempty"`
	LogLevel      string `json:"logLevel,omitempty"`
	LogFileSize   int    `json:"logFileSize,omitempty"`
	LogFileCount  int    `json:"logFileCount,omitempty"`
	LogFileMaxAge int    `json:"logFileMaxAge,omitempty"`
}

LogConfig contains logging configuration

type LogLevel

type LogLevel int

LogLevel - Error(1), Warn(2), Info(3), Debug(4) or Trace(5)

const (
	ERROR LogLevel = 1 + iota
	WARN
	INFO
	DEBUG
	TRACE
)

Constants for log level

Jump to

Keyboard shortcuts

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