feat: setup logours for logging

This commit is contained in:
Lakhan Samani
2022-05-13 00:47:01 +05:30
parent 773213e5a4
commit da0fcb109b
21 changed files with 93 additions and 82 deletions

View File

@@ -2,7 +2,8 @@ package main
import (
"flag"
"log"
log "github.com/sirupsen/logrus"
"github.com/authorizerdev/authorizer/server/constants"
"github.com/authorizerdev/authorizer/server/db"
@@ -21,7 +22,9 @@ func main() {
envstore.ARG_ENV_FILE = flag.String("env_file", "", "Env file path")
flag.Parse()
log.Println("=> version:", VERSION)
log.SetFormatter(&log.JSONFormatter{})
log.SetReportCaller(true)
constants.VERSION = VERSION
// initialize required envs (mainly db & env file path)
@@ -62,5 +65,6 @@ func main() {
}
router := routes.InitRouter()
log.Info("Starting Authorizer: ", VERSION)
router.Run(":" + envstore.EnvStoreObj.GetStringStoreEnvVariable(constants.EnvKeyPort))
}