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
31c746d9
Commit
31c746d9
authored
Jul 26, 2018
by
two
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix all confict
parent
38a2f322
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
39 deletions
+5
-39
file.go
logs/file.go
+5
-29
logger_test.go
logs/logger_test.go
+0
-10
No files found.
logs/file.go
View file @
31c746d9
...
@@ -306,7 +306,6 @@ func (w *fileLogWriter) doRotate(logTime time.Time) error {
...
@@ -306,7 +306,6 @@ func (w *fileLogWriter) doRotate(logTime time.Time) error {
goto
RESTART_LOGGER
goto
RESTART_LOGGER
}
}
<<<<<<<
HEAD
if
w
.
Hourly
{
if
w
.
Hourly
{
format
=
"2006010215"
format
=
"2006010215"
openTime
=
w
.
hourlyOpenTime
openTime
=
w
.
hourlyOpenTime
...
@@ -315,31 +314,18 @@ func (w *fileLogWriter) doRotate(logTime time.Time) error {
...
@@ -315,31 +314,18 @@ func (w *fileLogWriter) doRotate(logTime time.Time) error {
openTime
=
w
.
dailyOpenTime
openTime
=
w
.
dailyOpenTime
}
}
if
w
.
MaxLines
>
0
||
w
.
MaxSize
>
0
{
for
;
err
==
nil
&&
num
<=
999
;
num
++
{
fName
=
w
.
fileNameOnly
+
fmt
.
Sprintf
(
".%s.%03d%s"
,
logTime
.
Format
(
format
),
num
,
w
.
suffix
)
_
,
err
=
os
.
Lstat
(
fName
)
}
}
else
{
fName
=
fmt
.
Sprintf
(
"%s.%s%s"
,
w
.
fileNameOnly
,
openTime
.
Format
(
format
),
w
.
suffix
)
_
,
err
=
os
.
Lstat
(
fName
)
for
;
err
==
nil
&&
num
<=
999
;
num
++
{
fName
=
w
.
fileNameOnly
+
fmt
.
Sprintf
(
".%s.%03d%s"
,
openTime
.
Format
(
format
),
num
,
w
.
suffix
)
_
,
err
=
os
.
Lstat
(
fName
)
}
=======
// only when one of them be setted, then the file would be splited
// only when one of them be setted, then the file would be splited
if
w
.
MaxLines
>
0
||
w
.
MaxSize
>
0
{
if
w
.
MaxLines
>
0
||
w
.
MaxSize
>
0
{
for
;
err
==
nil
&&
num
<=
w
.
MaxFiles
;
num
++
{
for
;
err
==
nil
&&
num
<=
w
.
MaxFiles
;
num
++
{
fName
=
w
.
fileNameOnly
+
fmt
.
Sprintf
(
".%s.%03d%s"
,
logTime
.
Format
(
"2006-01-02"
),
num
,
w
.
suffix
)
fName
=
w
.
fileNameOnly
+
fmt
.
Sprintf
(
".%s.%03d%s"
,
logTime
.
Format
(
format
),
num
,
w
.
suffix
)
_
,
err
=
os
.
Lstat
(
fName
)
_
,
err
=
os
.
Lstat
(
fName
)
}
}
}
else
{
}
else
{
fName
=
w
.
fileNameOnly
+
fmt
.
Sprintf
(
".%s.%03d%s"
,
w
.
dailyOpenTime
.
Format
(
"2006-01-02"
),
num
,
w
.
suffix
)
fName
=
w
.
fileNameOnly
+
fmt
.
Sprintf
(
".%s.%03d%s"
,
openTime
.
Format
(
format
),
num
,
w
.
suffix
)
_
,
err
=
os
.
Lstat
(
fName
)
_
,
err
=
os
.
Lstat
(
fName
)
w
.
MaxFilesCurFiles
=
num
w
.
MaxFilesCurFiles
=
num
>>>>>>>
old
/
develop
}
}
// return error if the last file checked still existed
// return error if the last file checked still existed
if
err
==
nil
{
if
err
==
nil
{
return
fmt
.
Errorf
(
"Rotate: Cannot find free log number to rename %s"
,
w
.
Filename
)
return
fmt
.
Errorf
(
"Rotate: Cannot find free log number to rename %s"
,
w
.
Filename
)
...
@@ -383,31 +369,21 @@ func (w *fileLogWriter) deleteOldLog() {
...
@@ -383,31 +369,21 @@ func (w *fileLogWriter) deleteOldLog() {
if
info
==
nil
{
if
info
==
nil
{
return
return
}
}
<<<<<<<
HEAD
if
w
.
Hourly
{
if
w
.
Hourly
{
if
!
info
.
IsDir
()
&&
info
.
ModTime
()
.
Add
(
1
*
time
.
Hour
*
time
.
Duration
(
w
.
MaxHours
))
.
Before
(
time
.
Now
())
{
if
!
info
.
IsDir
()
&&
info
.
ModTime
()
.
Add
(
1
*
time
.
Hour
*
time
.
Duration
(
w
.
MaxHours
))
.
Before
(
time
.
Now
())
{
if
strings
.
HasPrefix
(
filepath
.
Base
(
path
),
filepath
.
Base
(
w
.
fileNameOnly
))
&&
if
strings
.
HasPrefix
(
filepath
.
Base
(
path
),
filepath
.
Base
(
w
.
fileNameOnly
))
&&
strings
.
HasSuffix
(
filepath
.
Base
(
path
),
w
.
suffix
)
{
strings
.
HasSuffix
(
filepath
.
Base
(
path
),
w
.
suffix
)
{
os
.
Remove
(
path
)
os
.
Remove
(
path
)
}
}
}
}
}
else
if
w
.
Daily
{
}
else
if
w
.
Daily
{
if
!
info
.
IsDir
()
&&
info
.
ModTime
()
.
Add
(
24
*
time
.
Hour
*
time
.
Duration
(
w
.
MaxDays
))
.
Before
(
time
.
Now
())
{
if
!
info
.
IsDir
()
&&
info
.
ModTime
()
.
Add
(
24
*
time
.
Hour
*
time
.
Duration
(
w
.
MaxDays
))
.
Before
(
time
.
Now
())
{
if
strings
.
HasPrefix
(
filepath
.
Base
(
path
),
filepath
.
Base
(
w
.
fileNameOnly
))
&&
if
strings
.
HasPrefix
(
filepath
.
Base
(
path
),
filepath
.
Base
(
w
.
fileNameOnly
))
&&
strings
.
HasSuffix
(
filepath
.
Base
(
path
),
w
.
suffix
)
{
strings
.
HasSuffix
(
filepath
.
Base
(
path
),
w
.
suffix
)
{
os
.
Remove
(
path
)
os
.
Remove
(
path
)
}
}
}
}
}
}
=======
if
!
info
.
IsDir
()
&&
info
.
ModTime
()
.
Add
(
24
*
time
.
Hour
*
time
.
Duration
(
w
.
MaxDays
))
.
Before
(
time
.
Now
())
{
if
strings
.
HasPrefix
(
filepath
.
Base
(
path
),
filepath
.
Base
(
w
.
fileNameOnly
))
&&
strings
.
HasSuffix
(
filepath
.
Base
(
path
),
w
.
suffix
)
{
os
.
Remove
(
path
)
}
}
>>>>>>>
old
/
develop
return
return
})
})
}
}
...
...
logs/logger_test.go
View file @
31c746d9
...
@@ -30,13 +30,8 @@ func TestFormatHeader_0(t *testing.T) {
...
@@ -30,13 +30,8 @@ func TestFormatHeader_0(t *testing.T) {
if
tm
.
Year
()
>=
2100
{
if
tm
.
Year
()
>=
2100
{
break
break
}
}
<<<<<<<
HEAD
h
,
_
,
_
:=
formatTimeHeader
(
tm
)
h
,
_
,
_
:=
formatTimeHeader
(
tm
)
if
tm
.
Format
(
"2006/01/02 15:04:05.999 "
)
!=
string
(
h
)
{
=======
h
,
_
:=
formatTimeHeader
(
tm
)
if
tm
.
Format
(
"2006/01/02 15:04:05.000 "
)
!=
string
(
h
)
{
if
tm
.
Format
(
"2006/01/02 15:04:05.000 "
)
!=
string
(
h
)
{
>>>>>>>
old
/
develop
t
.
Log
(
tm
)
t
.
Log
(
tm
)
t
.
FailNow
()
t
.
FailNow
()
}
}
...
@@ -53,13 +48,8 @@ func TestFormatHeader_1(t *testing.T) {
...
@@ -53,13 +48,8 @@ func TestFormatHeader_1(t *testing.T) {
if
tm
.
Year
()
>=
year
+
1
{
if
tm
.
Year
()
>=
year
+
1
{
break
break
}
}
<<<<<<<
HEAD
h
,
_
,
_
:=
formatTimeHeader
(
tm
)
h
,
_
,
_
:=
formatTimeHeader
(
tm
)
if
tm
.
Format
(
"2006/01/02 15:04:05.999 "
)
!=
string
(
h
)
{
=======
h
,
_
:=
formatTimeHeader
(
tm
)
if
tm
.
Format
(
"2006/01/02 15:04:05.000 "
)
!=
string
(
h
)
{
if
tm
.
Format
(
"2006/01/02 15:04:05.000 "
)
!=
string
(
h
)
{
>>>>>>>
old
/
develop
t
.
Log
(
tm
)
t
.
Log
(
tm
)
t
.
FailNow
()
t
.
FailNow
()
}
}
...
...
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