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 10, 2023 License: Apache-2.0, EPL-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(v interface{})

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

func Debugf

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

Debugf logs the given formatted message, if level is >= DEBUG

func Error

func Error(v interface{})

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

func Errorf

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

Errorf logs the given formatted message, if level is >= ERROR

func Info

func Info(v interface{})

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

func Infof

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

Infof logs the given formatted message, 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(v ...interface{})

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

func Tracef

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

Tracef logs the given formatted message, if level is >= TRACE

func Warn

func Warn(v interface{})

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

func Warnf

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

Warnf logs the given formatted message, if level is >= WARN

Types

type LogConfig

type LogConfig struct {
	LogFile       string `json:"logFile,omitempty" def:"{logFile}" descr:"Log file location in storage directory"`
	LogLevel      string `json:"logLevel,omitempty" def:"INFO" descr:"Log levels are ERROR, WARN, INFO, DEBUG, TRACE"`
	LogFileSize   int    `json:"logFileSize,omitempty" def:"2" descr:"Log file size in MB before it gets rotated"`
	LogFileCount  int    `json:"logFileCount,omitempty" def:"5" descr:"Log file max rotations count"`
	LogFileMaxAge int    `json:"logFileMaxAge,omitempty" def:"28" descr:"Log file rotations max age in days"`
}

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