Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
d99ae3e3
authored
2013-06-25 08:13:06 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add logrotate's setting for rotate
1 parent
4b09175d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
log.go
log.go
View file @
d99ae3e
...
...
@@ -46,6 +46,30 @@ func NewFileWriter(fname string, rotate bool) *FileLogWriter {
return
w
}
// Set rotate at linecount (chainable). Must be called before call StartLogger
func
(
w
*
FileLogWriter
)
SetRotateLines
(
maxlines
int
)
*
FileLogWriter
{
w
.
maxlines
=
maxlines
return
w
}
// Set rotate at size (chainable). Must be called before call StartLogger
func
(
w
*
FileLogWriter
)
SetRotateSize
(
maxsize
int
)
*
FileLogWriter
{
w
.
maxsize
=
maxsize
return
w
}
// Set rotate daily (chainable). Must be called before call StartLogger
func
(
w
*
FileLogWriter
)
SetRotateDaily
(
daily
bool
)
*
FileLogWriter
{
w
.
daily
=
daily
return
w
}
// Set rotate daily's log keep for maxday,other will delete
func
(
w
*
FileLogWriter
)
SetRotateMaxDay
(
maxday
int64
)
*
FileLogWriter
{
w
.
maxday
=
maxday
return
w
}
func
(
w
*
FileLogWriter
)
StartLogger
()
error
{
if
err
:=
w
.
DoRotate
(
false
);
err
!=
nil
{
return
err
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment