logs-fix-4

This commit is contained in:
Untone 2024-03-02 12:51:26 +03:00
parent f9e1316145
commit d6fec9121c

View File

@ -13,6 +13,7 @@ import (
"github.com/authorizerdev/authorizer/server/oauth"
"github.com/authorizerdev/authorizer/server/refs"
"github.com/authorizerdev/authorizer/server/routes"
"github.com/sirupsen/logrus"
)
// VERSION is used to define the version of authorizer from build tags
@ -26,25 +27,25 @@ func main() {
cli.ARG_REDIS_URL = flag.String("redis_url", "", "Redis connection string")
flag.Parse()
// global log level
logrus.SetFormatter(&logs.LogTextFormatter{})
constants.VERSION = VERSION
// initialize logrus
log := logs.InitLog(refs.StringValue(cli.ARG_LOG_LEVEL))
// initialize required envs (mainly db, env file path and redis)
err := memorystore.InitRequiredEnv()
if err != nil {
logrus.Fatal("Error while initializing required envs: ", err)
}
// set logrus formatter
log.SetFormatter(&logs.LogTextFormatter{})
log := logs.InitLog(refs.StringValue(cli.ARG_LOG_LEVEL))
log.SetFormatter(&logs.LogTextFormatter{})
// initialize required envs (mainly db, env file path and redis)
err := memorystore.InitRequiredEnv()
if err != nil {
log.Fatal("Error while initializing required envs: ", err)
}
// initialize required envs (mainly db, env file path and redis)
err = memorystore.InitRequiredEnv()
if err != nil {
log.Fatal("Error while initializing required envs: ", err)
}
// initialize memory store
err = memorystore.InitMemStore()
if err != nil {
log.Fatal("Error while initializing memory store: ", err)
}
// initialize db provider
err = db.InitDB()