Commit 5ac82f03 authored by 吴贤德's avatar 吴贤德

中心服务:去掉logrus日志输出,修复合作方媒资元数据推送问题(动态修改推送标志无效问题)

parent 0a94a2f9
package Config
import (
rotatelogs "github.com/lestrrat/go-file-rotatelogs"
"github.com/pkg/errors"
"github.com/rifflock/lfshook"
log "github.com/sirupsen/logrus"
"path"
"time"
)
// config logrus log to local filesystem, with file rotation
func initLogConfig(logPath string, logFileName string, maxAge time.Duration, rotationTime time.Duration) {
baseLogPaht := path.Join(logPath, logFileName)
writer, err := rotatelogs.New(
baseLogPaht+".%Y%m%d%H%M",
rotatelogs.WithLinkName(baseLogPaht), // 生成软链,指向最新日志文件
rotatelogs.WithMaxAge(maxAge), // 文件最大保存时间
rotatelogs.WithRotationTime(rotationTime), // 日志切割时间间隔
)
if err != nil {
log.Errorf("config local file system logger error. %+v", errors.WithStack(err))
}
lfHook := lfshook.NewHook(lfshook.WriterMap{
log.DebugLevel: writer, // 为不同级别设置不同的输出目的
log.InfoLevel: writer,
log.WarnLevel: writer,
log.ErrorLevel: writer,
log.FatalLevel: writer,
log.PanicLevel: writer,
}, &log.JSONFormatter{})
log.AddHook(lfHook)
//baseLogPaht := path.Join(logPath, logFileName)
//writer, err := rotatelogs.New(
// baseLogPaht+".%Y%m%d%H%M",
// rotatelogs.WithLinkName(baseLogPaht), // 生成软链,指向最新日志文件
// rotatelogs.WithMaxAge(maxAge), // 文件最大保存时间
// rotatelogs.WithRotationTime(rotationTime), // 日志切割时间间隔
//)
//if err != nil {
// log.Errorf("config local file system logger error. %+v", errors.WithStack(err))
//}
//lfHook := lfshook.NewHook(lfshook.WriterMap{
// log.DebugLevel: writer, // 为不同级别设置不同的输出目的
// log.InfoLevel: writer,
// log.WarnLevel: writer,
// log.ErrorLevel: writer,
// log.FatalLevel: writer,
// log.PanicLevel: writer,
//}, &log.JSONFormatter{})
//log.AddHook(lfHook)
}
......@@ -5,6 +5,7 @@ import (
"src/Common/DateTime"
"src/Common/Unit"
"src/Config"
"strconv"
"time"
)
......@@ -27,7 +28,12 @@ func (this *SpModel) Start() {
n = Unit.Time2Seconds(push_check_seconds)
}
this.push();
push_type,_:=strconv.Atoi(conf["push_type"].(string)) //0不推送,1推送
if push_type == 1 {
this.push();
}
}
......
......@@ -7,10 +7,10 @@ log_path = ./
log_filename = center_service.log
[debug]
api_conf_sys = http://192.168.200.134:801/api/center/conf_sys
api_conf_sps = http://192.168.200.134:801/api/center/conf_sps
api_conf_sites = http://192.168.200.134:801/api/center/conf_sites
api_tb_playlog_create = http://192.168.200.134:801/api/center/tb_playlog_create
api_conf_sys = http://192.168.200.134:80/api/center/conf_sys
api_conf_sps = http://192.168.200.134:80/api/center/conf_sps
api_conf_sites = http://192.168.200.134:80/api/center/conf_sites
api_tb_playlog_create = http://192.168.200.134:80/api/center/tb_playlog_create
log_path = ./
log_filename = center_service.log
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment