Reimplement logging

This commit is contained in:
Fred Boniface
2023-07-18 14:09:28 +01:00
parent b87bc82440
commit 857f1ef06c
9 changed files with 148 additions and 43 deletions

21
src/log/log.go Normal file
View File

@@ -0,0 +1,21 @@
package log
import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
var Msg *zap.Logger
func init() {
var err error
// Create a custom configuration with a human-readable "Console" encoder
config := zap.NewDevelopmentConfig()
config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder // Adds color to log levels
Msg, err = config.Build()
if err != nil {
panic("Failed to initialize logger: " + err.Error())
}
}