This commit is contained in:
crusader 2018-03-21 00:16:19 +09:00
parent 5db5cb3f2d
commit 3a7b7e4536

View File

@ -2,6 +2,7 @@ package logging
import (
"flag"
"fmt"
"log"
"git.loafle.net/commons_go/config"
@ -14,7 +15,7 @@ var (
)
func init() {
configPath = flag.String("logger-config-path", "./logging.json", "The path of logger config file")
configPath = flag.String("log-config-path", "./logging.json", "The path of logger config file")
flag.Parse()
}
@ -23,6 +24,8 @@ var logger *zap.Logger
func Logger() *zap.Logger {
if nil == logger {
initializeLogger()
logger.Info(fmt.Sprintf("Logger has been initialized. config[%s]", *configPath))
}
return logger
}
@ -38,6 +41,7 @@ func initializeLogger() {
if logger, err = zap.NewDevelopment(); nil != err {
log.Panicf("Building of logger config[Development] has been failed [%v]", err)
}
logger.Info("Logger has been initialized as development mode")
return
}