mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-11-09 18:45:44 +00:00
feat: add log in json option
This commit is contained in:
6
main.go
6
main.go
@@ -4,12 +4,16 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
"tinyauth/cmd"
|
||||
"tinyauth/internal/utils"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr, TimeFormat: time.RFC3339}).With().Timestamp().Caller().Logger()
|
||||
log.Logger = log.Logger.With().Timestamp().Caller().Logger()
|
||||
if !utils.ShoudLogJSON(os.Environ(), os.Args) {
|
||||
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr, TimeFormat: time.RFC3339})
|
||||
}
|
||||
cmd.Run()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user