1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2025-03-31 01:24:31 +00:00

changed logWarn to structured logging

This commit is contained in:
postmannen 2025-01-10 10:24:30 +01:00
parent 23a5555a35
commit d1bd3ad557
2 changed files with 5 additions and 7 deletions

View file

@ -320,15 +320,13 @@ func (p *pki) dbViewHash() ([]byte, error) {
//Open a bucket to get key's and values from.
bu := tx.Bucket([]byte("hash"))
if bu == nil {
er := fmt.Errorf("info: no db hash bucket exist")
p.errorKernel.logWarn(er)
p.errorKernel.logWarn("no db hash bucket exist", "bucket", "hash")
return nil
}
v := bu.Get([]byte("hash"))
if len(v) == 0 {
er := fmt.Errorf("info: view: hash key not found")
p.errorKernel.logWarn(er)
p.errorKernel.logWarn("dbViewHash: get bucket equals", "length", 0)
return nil
}

View file

@ -260,7 +260,7 @@ func (e *errorKernel) errSend(proc process, msg Message, err error, logLevel log
case logInfo:
e.logInfo("info", err)
case logWarning:
e.logWarn(err)
e.logWarn("warn", err)
case logDebug:
e.logDebug(err)
}
@ -289,8 +289,8 @@ func (e *errorKernel) logInfo(msg string, args ...any) {
slog.Info(msg, args...)
}
func (e *errorKernel) logWarn(err error) {
slog.Warn("warn", err.Error())
func (e *errorKernel) logWarn(msg string, args ...any) {
slog.Warn(msg, args...)
}
func (e *errorKernel) logDebug(err error) {