Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SooonerHotel
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴贤德
SooonerHotel
Commits
5ac82f03
Commit
5ac82f03
authored
5 years ago
by
吴贤德
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
中心服务:去掉logrus日志输出,修复合作方媒资元数据推送问题(动态修改推送标志无效问题)
parent
0a94a2f9
develop
v1.2
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
29 deletions
+30
-29
LogConfig.go
Services/CenterService/Config/LogConfig.go
+19
-24
SpModel.go
Services/CenterService/Model/Sp/SpModel.go
+7
-1
config.ini
Services/CenterService/config.ini
+4
-4
No files found.
Services/CenterService/Config/LogConfig.go
View file @
5ac82f03
package
Config
package
Config
import
(
import
(
rotatelogs
"github.com/lestrrat/go-file-rotatelogs"
"github.com/pkg/errors"
"github.com/rifflock/lfshook"
log
"github.com/sirupsen/logrus"
"path"
"time"
"time"
)
)
// config logrus log to local filesystem, with file rotation
// config logrus log to local filesystem, with file rotation
func
initLogConfig
(
logPath
string
,
logFileName
string
,
maxAge
time
.
Duration
,
rotationTime
time
.
Duration
)
{
func
initLogConfig
(
logPath
string
,
logFileName
string
,
maxAge
time
.
Duration
,
rotationTime
time
.
Duration
)
{
baseLogPaht
:=
path
.
Join
(
logPath
,
logFileName
)
//
baseLogPaht := path.Join(logPath, logFileName)
writer
,
err
:=
rotatelogs
.
New
(
//
writer, err := rotatelogs.New(
baseLogPaht
+
".%Y%m%d%H%M"
,
//
baseLogPaht+".%Y%m%d%H%M",
rotatelogs
.
WithLinkName
(
baseLogPaht
),
// 生成软链,指向最新日志文件
//
rotatelogs.WithLinkName(baseLogPaht), // 生成软链,指向最新日志文件
rotatelogs
.
WithMaxAge
(
maxAge
),
// 文件最大保存时间
//
rotatelogs.WithMaxAge(maxAge), // 文件最大保存时间
rotatelogs
.
WithRotationTime
(
rotationTime
),
// 日志切割时间间隔
//
rotatelogs.WithRotationTime(rotationTime), // 日志切割时间间隔
)
//
)
if
err
!=
nil
{
//
if err != nil {
log
.
Errorf
(
"config local file system logger error. %+v"
,
errors
.
WithStack
(
err
))
//
log.Errorf("config local file system logger error. %+v", errors.WithStack(err))
}
//
}
lfHook
:=
lfshook
.
NewHook
(
lfshook
.
WriterMap
{
//
lfHook := lfshook.NewHook(lfshook.WriterMap{
log
.
DebugLevel
:
writer
,
// 为不同级别设置不同的输出目的
//
log.DebugLevel: writer, // 为不同级别设置不同的输出目的
log
.
InfoLevel
:
writer
,
//
log.InfoLevel: writer,
log
.
WarnLevel
:
writer
,
//
log.WarnLevel: writer,
log
.
ErrorLevel
:
writer
,
//
log.ErrorLevel: writer,
log
.
FatalLevel
:
writer
,
//
log.FatalLevel: writer,
log
.
PanicLevel
:
writer
,
//
log.PanicLevel: writer,
},
&
log
.
JSONFormatter
{})
//
}, &log.JSONFormatter{})
log
.
AddHook
(
lfHook
)
//
log.AddHook(lfHook)
}
}
This diff is collapsed.
Click to expand it.
Services/CenterService/Model/Sp/SpModel.go
View file @
5ac82f03
...
@@ -5,6 +5,7 @@ import (
...
@@ -5,6 +5,7 @@ import (
"src/Common/DateTime"
"src/Common/DateTime"
"src/Common/Unit"
"src/Common/Unit"
"src/Config"
"src/Config"
"strconv"
"time"
"time"
)
)
...
@@ -27,7 +28,12 @@ func (this *SpModel) Start() {
...
@@ -27,7 +28,12 @@ func (this *SpModel) Start() {
n
=
Unit
.
Time2Seconds
(
push_check_seconds
)
n
=
Unit
.
Time2Seconds
(
push_check_seconds
)
}
}
this
.
push
();
push_type
,
_
:=
strconv
.
Atoi
(
conf
[
"push_type"
]
.
(
string
))
//0不推送,1推送
if
push_type
==
1
{
this
.
push
();
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Services/CenterService/config.ini
View file @
5ac82f03
...
@@ -7,10 +7,10 @@ log_path = ./
...
@@ -7,10 +7,10 @@ log_path = ./
log_filename
=
center_service.log
log_filename
=
center_service.log
[debug]
[debug]
api_conf_sys
=
http://192.168.200.134:80
1
/api/center/conf_sys
api_conf_sys
=
http://192.168.200.134:80/api/center/conf_sys
api_conf_sps
=
http://192.168.200.134:80
1
/api/center/conf_sps
api_conf_sps
=
http://192.168.200.134:80/api/center/conf_sps
api_conf_sites
=
http://192.168.200.134:80
1
/api/center/conf_sites
api_conf_sites
=
http://192.168.200.134:80/api/center/conf_sites
api_tb_playlog_create
=
http://192.168.200.134:80
1
/api/center/tb_playlog_create
api_tb_playlog_create
=
http://192.168.200.134:80/api/center/tb_playlog_create
log_path
=
./
log_path
=
./
log_filename
=
center_service.log
log_filename
=
center_service.log
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment