f-21: log: add full log info
All checks were successful
Pre Release Workflow / set-release-target (push) Successful in 1s
Pre Release Workflow / build (agent, amd64, linux) (push) Successful in 1m33s
Pre Release Workflow / build (db, amd64, linux) (push) Successful in 1m30s
Pre Release Workflow / build (metadata, amd64, linux) (push) Successful in 1m32s
Pre Release Workflow / upload-scripts (run-dnsmasq-in-netns.sh) (push) Successful in 6s
Pre Release Workflow / prerelease (push) Successful in 12s
Pre Release Workflow / build (metacli, amd64, linux) (push) Successful in 1m31s
All checks were successful
Pre Release Workflow / set-release-target (push) Successful in 1s
Pre Release Workflow / build (agent, amd64, linux) (push) Successful in 1m33s
Pre Release Workflow / build (db, amd64, linux) (push) Successful in 1m30s
Pre Release Workflow / build (metadata, amd64, linux) (push) Successful in 1m32s
Pre Release Workflow / upload-scripts (run-dnsmasq-in-netns.sh) (push) Successful in 6s
Pre Release Workflow / prerelease (push) Successful in 12s
Pre Release Workflow / build (metacli, amd64, linux) (push) Successful in 1m31s
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
fe6792be0d
commit
921a5ca96e
6 changed files with 116 additions and 22 deletions
25
pkg/logger/logger.go
Normal file
25
pkg/logger/logger.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package logger
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"os"
|
||||
)
|
||||
|
||||
var Level = new(slog.LevelVar)
|
||||
|
||||
func New(level string, debug bool) *slog.Logger {
|
||||
switch level {
|
||||
case "debug":
|
||||
Level.Set(slog.LevelDebug)
|
||||
case "warn":
|
||||
Level.Set(slog.LevelWarn)
|
||||
case "error":
|
||||
Level.Set(slog.LevelError)
|
||||
default:
|
||||
Level.Set(slog.LevelInfo)
|
||||
}
|
||||
if debug {
|
||||
Level.Set(slog.LevelDebug)
|
||||
}
|
||||
return slog.New(slog.NewJSONHandler(os.Stderr, &slog.HandlerOptions{Level: Level}))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue