Skip to content

Commit

Permalink
Merge pull request #26 from yunkon-kim/patch-yunkon-kim-01
Browse files Browse the repository at this point in the history
Fix duplicate logging to file
  • Loading branch information
powerkimhub authored Aug 22, 2022
2 parents fa5ba66 + a01074e commit 244d7ec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cblogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ func getLoggerHandler(loggerName string, configFilePath string) *logrus.Logger {
if loggerName != "" {
thisLogger.loggerName = loggerName
thisLogger.logrus.SetFormatter(getFormatter(loggerName))
setup(loggerName, configFilePath)
}
return thisLogger.logrus
}

thisLogger = new(CBLogger)
thisLogger.loggerName = loggerName
thisLogger.logrus = &logrus.Logger{
Expand Down Expand Up @@ -128,6 +128,11 @@ func GetLevel() string {

func getFormatter(loggerName string) *cblogformatter.Formatter {

if thisFormatter != nil {
thisFormatter.LogFormat = "[" + loggerName + "]." + "[%lvl%]: %time% %func% - %msg% \t[%keyvalues%]\n"
return thisFormatter
}

// 출력 포맷 조정 (keyvalues) 추가 (Formatter.go에서 해당 위치에 실제 데이터로 변경)
thisFormatter = &cblogformatter.Formatter{
TimestampFormat: "2006-01-02 15:04:05",
Expand Down

0 comments on commit 244d7ec

Please sign in to comment.