|
|
|
@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
@ -103,17 +103,21 @@ func initConfig() {
|
|
|
|
|
fmt.Println("viper.Unmarshal", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initLogger(cfg.Level)
|
|
|
|
|
initLogger(cfg.Level, cfg.LogEncoding)
|
|
|
|
|
|
|
|
|
|
cfg.Database.Prefix = "mnt_"
|
|
|
|
|
|
|
|
|
|
logger.Info("config", zap.Any("config", cfg))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func initLogger(level string, paths ...string) {
|
|
|
|
|
func initLogger(level, LogEncoding string, paths ...string) {
|
|
|
|
|
var err error
|
|
|
|
|
|
|
|
|
|
cfg := zap.NewProductionConfig()
|
|
|
|
|
cfg.Encoding = "console"
|
|
|
|
|
if LogEncoding != "console" {
|
|
|
|
|
cfg.Encoding = "json"
|
|
|
|
|
}
|
|
|
|
|
cfg.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
|
|
|
|
|
|
|
|
|
|
lv := zap.InfoLevel
|
|
|
|
|