Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
ficus_clientserver
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yunpeng.song
ficus_clientserver
Commits
fcdbed1c
Commit
fcdbed1c
authored
Nov 14, 2019
by
yunpeng.song
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日志切割时间给为2小时
parent
af5cc75d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
log.go
+3
-3
No files found.
log.go
View file @
fcdbed1c
...
@@ -27,9 +27,9 @@ func InitLog() {
...
@@ -27,9 +27,9 @@ func InitLog() {
log
.
SetLevel
(
log
.
InfoLevel
)
log
.
SetLevel
(
log
.
InfoLevel
)
logWriter
,
err
:=
rotatelogs
.
New
(
logWriter
,
err
:=
rotatelogs
.
New
(
logName
+
".%Y-%m-%d-%H-%M.log"
,
logName
+
".%Y-%m-%d-%H-%M.log"
,
rotatelogs
.
WithLinkName
(
logName
),
// 生成软链,指向最新日志文件
rotatelogs
.
WithLinkName
(
logName
),
// 生成软链,指向最新日志文件
rotatelogs
.
WithMaxAge
(
30
*
24
*
time
.
Hour
),
// 文件最大保存时间
rotatelogs
.
WithMaxAge
(
30
*
24
*
time
.
Hour
),
// 文件最大保存时间
rotatelogs
.
WithRotationTime
(
2
4
*
time
.
Hour
),
// 日志切割时间间隔
rotatelogs
.
WithRotationTime
(
2
*
time
.
Hour
),
// 日志切割时间间隔
//rotatelogs.WithRotationTime(1*time.Minute),
//rotatelogs.WithRotationTime(1*time.Minute),
)
)
writeMap
:=
lfshook
.
WriterMap
{
writeMap
:=
lfshook
.
WriterMap
{
...
...
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