Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
3bcff779
Commit
3bcff779
authored
Jun 25, 2013
by
Dobrosław Żybort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change: SetRotateMaxDay => SetRotateMaxDays
parent
b04813e4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
Quickstart.md
docs/zh/Quickstart.md
+1
-1
log.go
log.go
+6
-6
No files found.
docs/zh/Quickstart.md
View file @
3bcff779
...
@@ -787,7 +787,7 @@ beego默认有一个初始化的BeeLogger对象输出内容到stdout中,你可
...
@@ -787,7 +787,7 @@ beego默认有一个初始化的BeeLogger对象输出内容到stdout中,你可
-
func (w
*FileLogWriter) SetRotateDaily(daily bool) *
FileLogWriter
-
func (w
*FileLogWriter) SetRotateDaily(daily bool) *
FileLogWriter
-
func (w
*FileLogWriter) SetRotateLines(maxlines int) *
FileLogWriter
-
func (w
*FileLogWriter) SetRotateLines(maxlines int) *
FileLogWriter
-
func (w
*FileLogWriter) SetRotateMaxDay
(maxday
int64) *
FileLogWriter
-
func (w
*FileLogWriter) SetRotateMaxDay
s(maxdays
int64) *
FileLogWriter
-
func (w
*FileLogWriter) SetRotateSize(maxsize int) *
FileLogWriter
-
func (w
*FileLogWriter) SetRotateSize(maxsize int) *
FileLogWriter
但是这些函数调用必须在调用
`StartLogger`
之前。
但是这些函数调用必须在调用
`StartLogger`
之前。
...
...
log.go
View file @
3bcff779
...
@@ -26,7 +26,7 @@ type FileLogWriter struct {
...
@@ -26,7 +26,7 @@ type FileLogWriter struct {
// Rotate daily
// Rotate daily
daily
bool
daily
bool
maxday
int64
maxday
s
int64
daily_opendate
int
daily_opendate
int
rotate
bool
rotate
bool
...
@@ -40,7 +40,7 @@ func NewFileWriter(fname string, rotate bool) *FileLogWriter {
...
@@ -40,7 +40,7 @@ func NewFileWriter(fname string, rotate bool) *FileLogWriter {
maxlines
:
1000000
,
maxlines
:
1000000
,
maxsize
:
1
<<
28
,
//256 MB
maxsize
:
1
<<
28
,
//256 MB
daily
:
true
,
daily
:
true
,
maxday
:
7
,
maxday
s
:
7
,
rotate
:
rotate
,
rotate
:
rotate
,
}
}
return
w
return
w
...
@@ -64,9 +64,9 @@ func (w *FileLogWriter) SetRotateDaily(daily bool) *FileLogWriter {
...
@@ -64,9 +64,9 @@ func (w *FileLogWriter) SetRotateDaily(daily bool) *FileLogWriter {
return
w
return
w
}
}
// Set rotate daily's log keep for maxday
,
other will delete
// Set rotate daily's log keep for maxday
s,
other will delete
func
(
w
*
FileLogWriter
)
SetRotateMaxDay
(
maxday
int64
)
*
FileLogWriter
{
func
(
w
*
FileLogWriter
)
SetRotateMaxDay
s
(
maxdays
int64
)
*
FileLogWriter
{
w
.
maxday
=
maxday
w
.
maxday
s
=
maxdays
return
w
return
w
}
}
...
@@ -155,7 +155,7 @@ func (w *FileLogWriter) DoRotate(rotate bool) error {
...
@@ -155,7 +155,7 @@ func (w *FileLogWriter) DoRotate(rotate bool) error {
func
(
w
*
FileLogWriter
)
deleteOldLog
()
{
func
(
w
*
FileLogWriter
)
deleteOldLog
()
{
dir
:=
path
.
Dir
(
w
.
filename
)
dir
:=
path
.
Dir
(
w
.
filename
)
filepath
.
Walk
(
dir
,
func
(
path
string
,
info
os
.
FileInfo
,
err
error
)
error
{
filepath
.
Walk
(
dir
,
func
(
path
string
,
info
os
.
FileInfo
,
err
error
)
error
{
if
!
info
.
IsDir
()
&&
info
.
ModTime
()
.
Unix
()
<
(
time
.
Now
()
.
Unix
()
-
60
*
60
*
24
*
w
.
maxday
)
{
if
!
info
.
IsDir
()
&&
info
.
ModTime
()
.
Unix
()
<
(
time
.
Now
()
.
Unix
()
-
60
*
60
*
24
*
w
.
maxday
s
)
{
os
.
Remove
(
path
)
os
.
Remove
(
path
)
}
}
return
nil
return
nil
...
...
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