deepsource: fix confusing naming of struct fields
This commit is contained in:
parent
1a52d005b1
commit
16549e5019
@ -73,7 +73,7 @@ type fileLogWriter struct {
|
|||||||
|
|
||||||
fileNameOnly, suffix string // like "project.log", project is fileNameOnly and .log is suffix
|
fileNameOnly, suffix string // like "project.log", project is fileNameOnly and .log is suffix
|
||||||
|
|
||||||
formatter LogFormatter
|
logFormatter LogFormatter
|
||||||
Formatter string `json:"formatter"`
|
Formatter string `json:"formatter"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ func newFileWriter() Logger {
|
|||||||
MaxFiles: 999,
|
MaxFiles: 999,
|
||||||
MaxSize: 1 << 28,
|
MaxSize: 1 << 28,
|
||||||
}
|
}
|
||||||
w.formatter = w
|
w.logFormatter = w
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ func (*fileLogWriter) Format(lm *LogMsg) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w *fileLogWriter) SetFormatter(f LogFormatter) {
|
func (w *fileLogWriter) SetFormatter(f LogFormatter) {
|
||||||
w.formatter = f
|
w.logFormatter = f
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init file logger with json config.
|
// Init file logger with json config.
|
||||||
@ -138,7 +138,7 @@ func (w *fileLogWriter) Init(config string) error {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("the formatter with name: %s not found", w.Formatter)
|
return fmt.Errorf("the formatter with name: %s not found", w.Formatter)
|
||||||
}
|
}
|
||||||
w.formatter = fmtr
|
w.logFormatter = fmtr
|
||||||
}
|
}
|
||||||
err = w.startLogger()
|
err = w.startLogger()
|
||||||
return err
|
return err
|
||||||
@ -177,7 +177,7 @@ func (w *fileLogWriter) WriteMsg(lm *LogMsg) error {
|
|||||||
|
|
||||||
_, d, h := formatTimeHeader(lm.When)
|
_, d, h := formatTimeHeader(lm.When)
|
||||||
|
|
||||||
msg := w.formatter.Format(lm)
|
msg := w.logFormatter.Format(lm)
|
||||||
if w.Rotate {
|
if w.Rotate {
|
||||||
w.RLock()
|
w.RLock()
|
||||||
if w.needRotateHourly(h) {
|
if w.needRotateHourly(h) {
|
||||||
|
|||||||
@ -324,7 +324,7 @@ func testFileRotate(t *testing.T, fn1, fn2 string, daily, hourly bool) {
|
|||||||
DirPerm: "0770",
|
DirPerm: "0770",
|
||||||
RotatePerm: "0440",
|
RotatePerm: "0440",
|
||||||
}
|
}
|
||||||
fw.formatter = fw
|
fw.logFormatter = fw
|
||||||
|
|
||||||
if daily {
|
if daily {
|
||||||
fw.Init(fmt.Sprintf(`{"filename":"%v","maxdays":1}`, fn1))
|
fw.Init(fmt.Sprintf(`{"filename":"%v","maxdays":1}`, fn1))
|
||||||
@ -366,7 +366,7 @@ func testFileDailyRotate(t *testing.T, fn1, fn2 string) {
|
|||||||
DirPerm: "0770",
|
DirPerm: "0770",
|
||||||
RotatePerm: "0440",
|
RotatePerm: "0440",
|
||||||
}
|
}
|
||||||
fw.formatter = fw
|
fw.logFormatter = fw
|
||||||
|
|
||||||
fw.Init(fmt.Sprintf(`{"filename":"%v","maxdays":1}`, fn1))
|
fw.Init(fmt.Sprintf(`{"filename":"%v","maxdays":1}`, fn1))
|
||||||
fw.dailyOpenTime = time.Now().Add(-24 * time.Hour)
|
fw.dailyOpenTime = time.Now().Add(-24 * time.Hour)
|
||||||
@ -402,7 +402,7 @@ func testFileHourlyRotate(t *testing.T, fn1, fn2 string) {
|
|||||||
RotatePerm: "0440",
|
RotatePerm: "0440",
|
||||||
}
|
}
|
||||||
|
|
||||||
fw.formatter = fw
|
fw.logFormatter = fw
|
||||||
fw.Init(fmt.Sprintf(`{"filename":"%v","maxhours":1}`, fn1))
|
fw.Init(fmt.Sprintf(`{"filename":"%v","maxhours":1}`, fn1))
|
||||||
fw.hourlyOpenTime = time.Now().Add(-1 * time.Hour)
|
fw.hourlyOpenTime = time.Now().Add(-1 * time.Hour)
|
||||||
fw.hourlyOpenDate = fw.hourlyOpenTime.Hour()
|
fw.hourlyOpenDate = fw.hourlyOpenTime.Hour()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user