Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance logger #43

Merged
merged 1 commit into from
Dec 19, 2023
Merged

Enhance logger #43

merged 1 commit into from
Dec 19, 2023

Conversation

yunkon-kim
Copy link
Member

  • Share a single lumberjack.Logger instace/file point for concurrency
  • Add NewLogger()
  • Modify init() with the the lumberjack and NewLogger()
  • Exception handling
    • When an incorrect value is entered,
    • a Warn message is output and the default value is applied.
Click to see test code
l1 := logger.NewLogger(zerolog.ErrorLevel)
l2 := logger.NewLogger(zerolog.WarnLevel)
l3 := logger.NewLogger(zerolog.InfoLevel)
l4 := logger.NewLogger(zerolog.DebugLevel)
l5 := logger.NewLogger(zerolog.TraceLevel)

go func() {
for i := 0; i < 50; i++ {
    log.Debug().Msg("[log] Debug mesaage")
    log.Info().Msg("[log] Info mesaage")
    log.Warn().Msg("[log] Warn mesaage")
    log.Error().Msg("[log] Error mesaage")
}
}()

go func() {
for i := 0; i < 50; i++ {
    l1.Debug().Msg("[l1] Debug mesaage")
    l1.Info().Msg("[l1] Info mesaage")
    l1.Warn().Msg("[l1] Warn mesaage")
    l1.Error().Msg("[l1] Error mesaage")
}
}()

go func() {
for i := 0; i < 50; i++ {
    l2.Debug().Msg("[l2] Debug mesaage")
    l2.Info().Msg("[l2] Info mesaage")
    l2.Warn().Msg("[l2] Warn mesaage")
    l2.Error().Msg("[l2] Error mesaage")
}
}()

go func() {
for i := 0; i < 50; i++ {
    l3.Debug().Msg("[l3] Debug mesaage")
    l3.Info().Msg("[l3] Info mesaage")
    l3.Warn().Msg("[l3] Warn mesaage")
    l3.Error().Msg("[l3] Error mesaage")
}
}()

go func() {
for i := 0; i < 50; i++ {
    l4.Debug().Msg("[l4] Debug mesaage")
    l4.Info().Msg("[l4] Info mesaage")
    l4.Warn().Msg("[l4] Warn mesaage")
    l4.Error().Msg("[l4] Error mesaage")
}
}()

go func() {
for i := 0; i < 50; i++ {
    l5.Debug().Msg("[l5] Debug mesaage")
    l5.Info().Msg("[l5] Info mesaage")
    l5.Warn().Msg("[l5] Warn mesaage")
    l5.Error().Msg("[l5] Error mesaage")
}
}()
Click to see partial test result
{"level":"info","logLevel":"debug","logFilePath":"cm-beetle.log","env":"development","maxSize":10,"maxBackups":3,"maxAge":30,"compress":false,"time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/pkg/logger/logger.go:74","message":"Global logger initialized"}
{"level":"info","logFilePath":"cm-beetle.log","ConsoleWriter":"os.Stdout","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/pkg/logger/logger.go:84","message":"Multi-writes setup (logs to both file and console)"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:89","message":"starting CM-Beetle server"}
{"level":"info","logLevel":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/pkg/logger/logger.go:114","message":"New logger created"}
{"level":"info","logFilePath":"cm-beetle.log","ConsoleWriter":"os.Stdout","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/pkg/logger/logger.go:124","message":"Multi-writes setup (logs to both file and console)"}
{"level":"info","logLevel":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/pkg/logger/logger.go:114","message":"New logger created"}
{"level":"info","logFilePath":"cm-beetle.log","ConsoleWriter":"os.Stdout","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/pkg/logger/logger.go:124","message":"Multi-writes setup (logs to both file and console)"}
{"level":"info","logLevel":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/pkg/logger/logger.go:114","message":"New logger created"}
{"level":"info","logFilePath":"cm-beetle.log","ConsoleWriter":"os.Stdout","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/pkg/logger/logger.go:124","message":"Multi-writes setup (logs to both file and console)"}
{"level":"info","logLevel":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/pkg/logger/logger.go:114","message":"New logger created"}
{"level":"info","logFilePath":"cm-beetle.log","ConsoleWriter":"os.Stdout","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/pkg/logger/logger.go:124","message":"Multi-writes setup (logs to both file and console)"}
{"level":"info","logLevel":"trace","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/pkg/logger/logger.go:114","message":"New logger created"}
{"level":"info","logFilePath":"cm-beetle.log","ConsoleWriter":"os.Stdout","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/pkg/logger/logger.go:124","message":"Multi-writes setup (logs to both file and console)"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:158","message":"port number: 8056"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:118","message":"[l2] Warn mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:98","message":"[log] Debug mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:119","message":"[l2] Error mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:99","message":"[log] Info mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:118","message":"[l2] Warn mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:143","message":"[l5] Debug mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:126","message":"[l3] Info mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:179","message":"setting SQL Database"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:134","message":"[l4] Debug mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:100","message":"[log] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:119","message":"[l2] Error mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:144","message":"[l5] Info mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:118","message":"[l2] Warn mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:127","message":"[l3] Warn mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:184","message":"database file path: ./meta_db/dat/cmbeetle.s3db"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:135","message":"[l4] Info mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:101","message":"[log] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:145","message":"[l5] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:98","message":"[log] Debug mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:119","message":"[l2] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:128","message":"[l3] Error mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/pkg/api/rest/server/server.go:89","message":"Setting CM-Beetle REST API server"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:136","message":"[l4] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:146","message":"[l5] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:143","message":"[l5] Debug mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:99","message":"[log] Info mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:118","message":"[l2] Warn mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:100","message":"[log] Warn mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:126","message":"[l3] Info mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:137","message":"[l4] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:144","message":"[l5] Info mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:119","message":"[l2] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:101","message":"[log] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:127","message":"[l3] Warn mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:98","message":"[log] Debug mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:128","message":"[l3] Error mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:99","message":"[log] Info mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:134","message":"[l4] Debug mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:145","message":"[l5] Warn mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:118","message":"[l2] Warn mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/pkg/api/rest/server/server.go:232","message":"starting CM-Beetle REST API server"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:126","message":"[l3] Info mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:119","message":"[l2] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:100","message":"[log] Warn mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:135","message":"[l4] Info mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:146","message":"[l5] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:136","message":"[l4] Warn mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:127","message":"[l3] Warn mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:118","message":"[l2] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:101","message":"[log] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:98","message":"[log] Debug mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:143","message":"[l5] Debug mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:137","message":"[l4] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:128","message":"[l3] Error mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:144","message":"[l5] Info mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:119","message":"[l2] Error mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:126","message":"[l3] Info mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:127","message":"[l3] Warn mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:99","message":"[log] Info mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:134","message":"[l4] Debug mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:145","message":"[l5] Warn mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:100","message":"[log] Warn mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:135","message":"[l4] Info mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:118","message":"[l2] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:101","message":"[log] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:128","message":"[l3] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:146","message":"[l5] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:136","message":"[l4] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:119","message":"[l2] Error mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:98","message":"[log] Debug mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:126","message":"[l3] Info mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:99","message":"[log] Info mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:143","message":"[l5] Debug mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:100","message":"[log] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:137","message":"[l4] Error mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:144","message":"[l5] Info mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:118","message":"[l2] Warn mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:127","message":"[l3] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:101","message":"[log] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:128","message":"[l3] Error mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:134","message":"[l4] Debug mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:126","message":"[l3] Info mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:135","message":"[l4] Info mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:145","message":"[l5] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:119","message":"[l2] Error mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:98","message":"[log] Debug mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:127","message":"[l3] Warn mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:118","message":"[l2] Warn mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:99","message":"[log] Info mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:128","message":"[l3] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:119","message":"[l2] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:136","message":"[l4] Warn mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:118","message":"[l2] Warn mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:100","message":"[log] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:119","message":"[l2] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:146","message":"[l5] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:126","message":"[l3] Info mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:143","message":"[l5] Debug mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:127","message":"[l3] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:137","message":"[l4] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:101","message":"[log] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:128","message":"[l3] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:118","message":"[l2] Warn mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:144","message":"[l5] Info mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:126","message":"[l3] Info mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:119","message":"[l2] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:145","message":"[l5] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:134","message":"[l4] Debug mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:98","message":"[log] Debug mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:127","message":"[l3] Warn mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:135","message":"[l4] Info mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:99","message":"[log] Info mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:118","message":"[l2] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:146","message":"[l5] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:128","message":"[l3] Error mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:143","message":"[l5] Debug mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:126","message":"[l3] Info mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:136","message":"[l4] Warn mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:100","message":"[log] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:119","message":"[l2] Error mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:144","message":"[l5] Info mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:101","message":"[log] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:118","message":"[l2] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:127","message":"[l3] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:137","message":"[l4] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:128","message":"[l3] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:145","message":"[l5] Warn mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:98","message":"[log] Debug mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:119","message":"[l2] Error mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:134","message":"[l4] Debug mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:99","message":"[log] Info mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:118","message":"[l2] Warn mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:135","message":"[l4] Info mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:126","message":"[l3] Info mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:146","message":"[l5] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:100","message":"[log] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:143","message":"[l5] Debug mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:119","message":"[l2] Error mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:144","message":"[l5] Info mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:136","message":"[l4] Warn mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:145","message":"[l5] Warn mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:127","message":"[l3] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:101","message":"[log] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:146","message":"[l5] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:118","message":"[l2] Warn mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:143","message":"[l5] Debug mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:137","message":"[l4] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:128","message":"[l3] Error mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:98","message":"[log] Debug mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:119","message":"[l2] Error mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:126","message":"[l3] Info mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:99","message":"[log] Info mesaage"}
{"level":"info","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:144","message":"[l5] Info mesaage"}
{"level":"debug","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:134","message":"[l4] Debug mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:100","message":"[log] Warn mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:145","message":"[l5] Warn mesaage"}
{"level":"error","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:110","message":"[l1] Error mesaage"}
{"level":"warn","time":"2023-12-19T18:55:16+09:00","caller":"/mnt/d/Dev/Cloud-Barista/cm-beetle/cmd/cm-beetle/main.go:118","message":"[l2] Warn mesaage"}

- Share a single lumberjack.Logger instace/file point for concurrency
- Add NewLogger()
- Modify init() with the the lumberjack and NewLogger()
- Exception handling
  - When an incorrect value is entered,
  - a Warn message is output and the default value is applied.
@yunkon-kim yunkon-kim linked an issue Dec 19, 2023 that may be closed by this pull request
Copy link
Member

@seokho-son seokho-son left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@seokho-son seokho-son merged commit 0625899 into cloud-barista:main Dec 19, 2023
2 checks passed
@yunkon-kim yunkon-kim deleted the enhance-logger branch December 20, 2023 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance logger to support multiple logger instances
2 participants