logger/logger.go

52 lines
1.3 KiB
Go

// Copyright (c) 2024 Celestino Amoroso (celestino.amoroso@gmail.com).
// All rights reserved.
// setup.go
package logger
import "io/fs"
const (
LOGGER_MAX_MESSAGE_LENGTH = iota + 1
IMPLEMENTATION_PROPERTY_BASE_ID = 100
)
type Logger interface {
Debugf(templ string, args ...any)
}
type FullLogger interface {
Logger
IsDebugEnabled() bool
IsInfoEnabled() bool
DebugRawb(msg []byte)
Dumpf(data []byte, perm fs.FileMode, templ string, args ...any) (dumpFilePath string)
DebugRawf(templ string, args ...any)
InfoRawf(templ string, args ...any)
WarnRawf(templ string, args ...any)
ErrorRawf(templ string, args ...any)
Infof(templ string, args ...any)
Warnf(templ string, args ...any)
Errorf(templ string, args ...any)
OobLogf(templ string, args ...any)
SetRotation(maxSize int64, rotateNumber int)
Finalize()
SetProperty(propertyId int, value any) (success bool)
GetProperty(propertyId int) (value any)
GetPropertyBool(propertyId int) (value bool, ok bool)
}
type VerboseLogger interface {
FullLogger
VerboseRedf(templ string, args ...any) string
VerboseGreenf(templ string, args ...any) string
VerboseBluef(templ string, args ...any) string
VerboseBrownf(templ string, args ...any) string
}
type NullLogger struct{}
func (self *NullLogger) Debugf(templ string, args ...any) {}