log

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoSyslogService = errors.New("failed to create syslog object")

Functions

func Crit

func Crit(msg string, args ...interface{})

Crit : Critical message logging

func Debug

func Debug(msg string, args ...interface{})

Debug : Debug message logging

func Destroy

func Destroy() error

Destroy : DeInitialize the logging library

func Err

func Err(msg string, args ...interface{})

Err : Error message logging

func GetLogLevel

func GetLogLevel() common.LogLevel

func GetLoggerObj

func GetLoggerObj() *log.Logger

func GetType

func GetType() string

func Info

func Info(msg string, args ...interface{})

Info : Info message logging

func LogRotate

func LogRotate() error

LogRotate : Rotate the log files explicitly

func SetConfig

func SetConfig(config common.LogConfig) error

func SetDefaultLogger

func SetDefaultLogger(name string, config common.LogConfig) error

func SetLogFile

func SetLogFile(name string) error

func SetLogFileCount

func SetLogFileCount(count int)

func SetLogLevel

func SetLogLevel(lvl common.LogLevel)

SetLogLevel : Reset the log level

func SetMaxLogSize

func SetMaxLogSize(size int)

func TimeTrack

func TimeTrack(start time.Time, location string, name string)

TimeTracker : Dump time taken by a call

func TimeTrackDiff

func TimeTrackDiff(diff time.Duration, location string, name string)

TimeTracker : Dump time taken by a call

func TimeTracker

func TimeTracker() bool

func Trace

func Trace(msg string, args ...interface{})

Trace : Trace message logging

func Warn

func Warn(msg string, args ...interface{})

Warn : Warning message logging

Types

type BaseLogger

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

func (*BaseLogger) Crit

func (l *BaseLogger) Crit(format string, args ...interface{})

func (*BaseLogger) Debug

func (l *BaseLogger) Debug(format string, args ...interface{})

func (*BaseLogger) Destroy

func (l *BaseLogger) Destroy() error

func (*BaseLogger) Err

func (l *BaseLogger) Err(format string, args ...interface{})

func (*BaseLogger) GetLogLevel

func (l *BaseLogger) GetLogLevel() common.LogLevel

func (*BaseLogger) GetLoggerObj

func (l *BaseLogger) GetLoggerObj() *log.Logger

func (*BaseLogger) GetType

func (l *BaseLogger) GetType() string

func (*BaseLogger) Info

func (l *BaseLogger) Info(format string, args ...interface{})

func (*BaseLogger) LogRotate

func (l *BaseLogger) LogRotate() error

func (*BaseLogger) SetLogFile

func (l *BaseLogger) SetLogFile(name string) error

func (*BaseLogger) SetLogFileCount

func (l *BaseLogger) SetLogFileCount(count int)

func (*BaseLogger) SetLogLevel

func (l *BaseLogger) SetLogLevel(level common.LogLevel)

func (*BaseLogger) SetMaxLogSize

func (l *BaseLogger) SetMaxLogSize(size int)

func (*BaseLogger) Trace

func (l *BaseLogger) Trace(format string, args ...interface{})

func (*BaseLogger) Warn

func (l *BaseLogger) Warn(format string, args ...interface{})

type LogFileConfig

type LogFileConfig struct {
	LogFile      string
	LogSize      uint64
	LogFileCount int
	LogLevel     common.LogLevel
	LogTag       string
	// contains filtered or unexported fields
}

LogConfig : Configuration to be provided to logging infra

type Logger

type Logger interface {
	GetLoggerObj() *log.Logger

	SetLogFile(name string) error
	SetMaxLogSize(size int)
	SetLogFileCount(count int)
	SetLogLevel(level common.LogLevel)

	Destroy() error

	GetType() string
	GetLogLevel() common.LogLevel
	Debug(format string, args ...interface{})
	Trace(format string, args ...interface{})
	Info(format string, args ...interface{})
	Warn(format string, args ...interface{})
	Err(format string, args ...interface{})
	Crit(format string, args ...interface{})
	LogRotate() error
}

Logger : Interface to define a generic Logger. Implement this to create your new logging lib

func NewLogger

func NewLogger(name string, config common.LogConfig) (Logger, error)

newLogger : Method to create Logger object

type SilentLogger

type SilentLogger struct {
}

func (*SilentLogger) Crit

func (*SilentLogger) Crit(_ string, _ ...interface{})

func (*SilentLogger) Debug

func (*SilentLogger) Debug(_ string, _ ...interface{})

func (*SilentLogger) Destroy

func (*SilentLogger) Destroy() error

func (*SilentLogger) Err

func (*SilentLogger) Err(_ string, _ ...interface{})

func (*SilentLogger) GetLogLevel

func (*SilentLogger) GetLogLevel() common.LogLevel

func (*SilentLogger) GetLoggerObj

func (*SilentLogger) GetLoggerObj() *log.Logger

func (*SilentLogger) GetType

func (*SilentLogger) GetType() string

func (*SilentLogger) Info

func (*SilentLogger) Info(_ string, _ ...interface{})

func (*SilentLogger) LogRotate

func (*SilentLogger) LogRotate() error

func (*SilentLogger) SetLogFile

func (*SilentLogger) SetLogFile(_ string) error

func (*SilentLogger) SetLogFileCount

func (*SilentLogger) SetLogFileCount(_ int)

func (*SilentLogger) SetLogLevel

func (*SilentLogger) SetLogLevel(_ common.LogLevel)

func (*SilentLogger) SetMaxLogSize

func (*SilentLogger) SetMaxLogSize(_ int)

func (*SilentLogger) Trace

func (*SilentLogger) Trace(_ string, _ ...interface{})

func (*SilentLogger) Warn

func (*SilentLogger) Warn(_ string, _ ...interface{})

type SysLogger

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

func (*SysLogger) Crit

func (l *SysLogger) Crit(format string, args ...interface{})

func (*SysLogger) Debug

func (l *SysLogger) Debug(format string, args ...interface{})

func (*SysLogger) Destroy

func (l *SysLogger) Destroy() error

func (*SysLogger) Err

func (l *SysLogger) Err(format string, args ...interface{})

func (*SysLogger) GetLogLevel

func (l *SysLogger) GetLogLevel() common.LogLevel

func (*SysLogger) GetLoggerObj

func (l *SysLogger) GetLoggerObj() *log.Logger

func (*SysLogger) GetType

func (l *SysLogger) GetType() string

func (*SysLogger) Info

func (l *SysLogger) Info(format string, args ...interface{})

func (*SysLogger) LogRotate

func (l *SysLogger) LogRotate() error

func (*SysLogger) SetLogFile

func (l *SysLogger) SetLogFile(name string) error

Methods not needed for syslog based logging

func (*SysLogger) SetLogFileCount

func (l *SysLogger) SetLogFileCount(count int)

func (*SysLogger) SetLogLevel

func (l *SysLogger) SetLogLevel(level common.LogLevel)

func (*SysLogger) SetMaxLogSize

func (l *SysLogger) SetMaxLogSize(size int)

func (*SysLogger) Trace

func (l *SysLogger) Trace(format string, args ...interface{})

func (*SysLogger) Warn

func (l *SysLogger) Warn(format string, args ...interface{})

Jump to

Keyboard shortcuts

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