exported logger.LogLevel

This commit is contained in:
Erkan DURMUŞ
2024-11-27 01:28:38 +03:00
committed by finley
parent 3197d82a9f
commit 6aee2f91e3

View File

@@ -20,11 +20,11 @@ type Settings struct {
TimeFormat string `yaml:"time-format"` TimeFormat string `yaml:"time-format"`
} }
type logLevel int type LogLevel int
// Output levels // Output levels
const ( const (
DEBUG logLevel = iota DEBUG LogLevel = iota
INFO INFO
WARNING WARNING
ERROR ERROR
@@ -39,7 +39,7 @@ const (
type logEntry struct { type logEntry struct {
msg string msg string
level logLevel level LogLevel
} }
var ( var (
@@ -48,7 +48,7 @@ var (
// ILogger defines the methods that any logger should implement // ILogger defines the methods that any logger should implement
type ILogger interface { type ILogger interface {
Output(level logLevel, callerDepth int, msg string) Output(level LogLevel, callerDepth int, msg string)
} }
// Logger is Logger // Logger is Logger
@@ -134,7 +134,7 @@ func Setup(settings *Settings) {
} }
// Output sends a msg to logger // Output sends a msg to logger
func (logger *Logger) Output(level logLevel, callerDepth int, msg string) { func (logger *Logger) Output(level LogLevel, callerDepth int, msg string) {
var formattedMsg string var formattedMsg string
_, file, line, ok := runtime.Caller(callerDepth) _, file, line, ok := runtime.Caller(callerDepth)
if ok { if ok {