1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 12:40:55 +00:00
This commit is contained in:
Jia Li Ong 2017-06-22 19:18:49 +08:00
commit 31b2b21dbc
2 changed files with 21 additions and 21 deletions

View File

@ -56,7 +56,7 @@ type fileLogWriter struct {
Perm string `json:"perm"`
OtherPerm string `json:"otherperm"`
RotatePerm string `json:"rotateperm"`
fileNameOnly, suffix string // like "project.log", project is fileNameOnly and .log is suffix
}
@ -67,7 +67,7 @@ func newFileWriter() Logger {
Daily: true,
MaxDays: 7,
Rotate: true,
OtherPerm: "0440",
RotatePerm: "0440",
Level: LevelTrace,
Perm: "0660",
}
@ -240,7 +240,7 @@ func (w *fileLogWriter) doRotate(logTime time.Time) error {
// Find the next available number
num := 1
fName := ""
otherPerm, err := strconv.ParseInt(w.OtherPerm, 8, 64)
rotatePerm, err := strconv.ParseInt(w.RotatePerm, 8, 64)
if err != nil {
return err
}
@ -279,7 +279,7 @@ func (w *fileLogWriter) doRotate(logTime time.Time) error {
goto RESTART_LOGGER
}
err = os.Chmod(fName, os.FileMode(otherPerm))
err = os.Chmod(fName, os.FileMode(rotatePerm))
RESTART_LOGGER:

View File

@ -190,7 +190,7 @@ func testFileRotate(t *testing.T, fn1, fn2 string) {
Rotate: true,
Level: LevelTrace,
Perm: "0660",
OtherPerm: "0440",
RotatePerm: "0440",
}
fw.Init(fmt.Sprintf(`{"filename":"%v","maxdays":1}`, fn1))
fw.dailyOpenTime = time.Now().Add(-24 * time.Hour)
@ -214,7 +214,7 @@ func testFileDailyRotate(t *testing.T, fn1, fn2 string) {
Rotate: true,
Level: LevelTrace,
Perm: "0660",
OtherPerm: "0440",
RotatePerm: "0440",
}
fw.Init(fmt.Sprintf(`{"filename":"%v","maxdays":1}`, fn1))
fw.dailyOpenTime = time.Now().Add(-24 * time.Hour)