Documentation
ΒΆ
Overview ΒΆ
*
- @License Apache License 2.0
- @Copyright (c) 2026 OTMC Softwares. OTMC Golang Logger.
- @Contributors Nguyen Van Trung, Nguyen Thi Hoai, OTMC Contributors.
*
*
- @License Apache License 2.0
- @Copyright (c) 2026 OTMC Softwares. OTMC Golang Logger.
- @Contributors Nguyen Van Trung, Nguyen Thi Hoai, OTMC Contributors. *
*
- @License Apache License 2.0
- @Copyright (c) 2026 OTMC Softwares. OTMC Golang Logger.
- @Contributors Nguyen Van Trung, Nguyen Thi Hoai, OTMC Contributors.
*
Index ΒΆ
- Constants
- func AddListener() chan LogEntry
- func Close() error
- func Configure(opts ...Option)
- func Crit(format string, args ...any)
- func Debug(format string, args ...any)
- func Error(format string, args ...any)
- func ErrorMetadata(metadata interface{}, format string, args ...any)
- func Info(format string, args ...any)
- func InfoMetadata(metadata interface{}, format string, args ...any)
- func RemoveListener(ch chan LogEntry)
- func Request(method, path string, statusCode int, latency time.Duration, clientIP string)
- func SetLevel(level Level)
- func Sync() error
- func Trace(format string, args ...any)
- func Update(cfg Config)
- func Warn(format string, args ...any)
- func WarnMetadata(metadata interface{}, format string, args ...any)
- type Config
- type Formatter
- type Hook
- type Level
- type LogEntry
- type Logger
- func (l *Logger) AddListener() chan LogEntry
- func (l *Logger) Close() error
- func (l *Logger) Config() Config
- func (l *Logger) Configure(opts ...Option)
- func (l *Logger) Crit(format string, args ...any)
- func (l *Logger) Debug(format string, args ...any)
- func (l *Logger) Error(format string, args ...any)
- func (l *Logger) ErrorMetadata(metadata interface{}, format string, args ...any)
- func (l *Logger) GetRecentLogs(limit int) []LogEntry
- func (l *Logger) Info(format string, args ...any)
- func (l *Logger) InfoMetadata(metadata interface{}, format string, args ...any)
- func (l *Logger) RemoveListener(ch chan LogEntry)
- func (l *Logger) Request(method, path string, statusCode int, latency time.Duration, clientIP string)
- func (l *Logger) SetLevel(level Level)
- func (l *Logger) Sync() error
- func (l *Logger) Trace(format string, args ...any)
- func (l *Logger) Update(cfg Config)
- func (l *Logger) Warn(format string, args ...any)
- func (l *Logger) WarnMetadata(metadata interface{}, format string, args ...any)
- type Option
- func WithCaller(enabled bool) Option
- func WithCompress(enabled bool) Option
- func WithConsole(enabled bool) Option
- func WithFile(filename string) Option
- func WithJSON(enabled bool) Option
- func WithLevel(level Level) Option
- func WithMaxAge(maxAge int) Option
- func WithMaxBackups(maxBackups int) Option
- func WithMaxLogEntries(maxEntries int) Option
- func WithMaxSize(maxSize float64) Option
- func WithStacktrace(enabled bool) Option
- func WithTimeFormat(format string) Option
Constants ΒΆ
View Source
const ( TraceLevel = core.TraceLevel DebugLevel = core.DebugLevel InfoLevel = core.InfoLevel WarnLevel = core.WarnLevel ErrorLevel = core.ErrorLevel CritLevel = core.CritLevel )
Variables ΒΆ
This section is empty.
Functions ΒΆ
func AddListener ΒΆ added in v0.1.8
func AddListener() chan LogEntry
func ErrorMetadata ΒΆ added in v0.1.10
func InfoMetadata ΒΆ added in v0.1.10
func RemoveListener ΒΆ added in v0.1.8
func RemoveListener(ch chan LogEntry)
func WarnMetadata ΒΆ added in v0.1.10
Types ΒΆ
type Config ΒΆ
type Config struct {
Level Level
Console bool
File bool
Filename string
JSON bool
Caller bool
Stacktrace bool
MaxSize float64
MaxBackups int
MaxAge int
Compress bool
TimeFormat string
MaxLogEntries int
}
func DefaultConfig ΒΆ
func DefaultConfig() Config
type LogEntry ΒΆ added in v0.1.8
func GetRecentLogs ΒΆ added in v0.1.8
type Logger ΒΆ
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) AddListener ΒΆ added in v0.1.8
func (*Logger) ErrorMetadata ΒΆ added in v0.1.10
func (*Logger) GetRecentLogs ΒΆ added in v0.1.8
func (*Logger) InfoMetadata ΒΆ added in v0.1.10
func (*Logger) RemoveListener ΒΆ added in v0.1.8
func (*Logger) WarnMetadata ΒΆ added in v0.1.10
type Option ΒΆ
type Option func(*Config)
func WithCaller ΒΆ
func WithCompress ΒΆ
func WithConsole ΒΆ
func WithMaxAge ΒΆ
func WithMaxBackups ΒΆ
func WithMaxLogEntries ΒΆ added in v0.1.8
func WithMaxSize ΒΆ
func WithStacktrace ΒΆ
func WithTimeFormat ΒΆ added in v0.1.4
Click to show internal directories.
Click to hide internal directories.