Skip to content

Commit 4018ddc

Browse files
committed
add LogNotToFile flag
1 parent 12459bb commit 4018ddc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

logger.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ const (
7070

7171
const (
7272
LogConsoleOnly = 1 << (8 + iota)
73+
LogNotToFile
7374
)
7475

7576
func (l LogLevel) String() string {
@@ -99,7 +100,7 @@ func logWrite(level LogLevel, buf []byte) {
99100
os.Stdout.Write(buf)
100101
}
101102
}
102-
if level&LogConsoleOnly == 0 {
103+
if level&LogConsoleOnly == 0 && level&LogNotToFile == 0 {
103104
if fd := logfile.Load(); fd != nil {
104105
fd.Write(buf)
105106
}
@@ -377,7 +378,7 @@ func LogAccess(level LogLevel, data any) {
377378
} else {
378379
s = (string)(bts.Bytes()[:bts.Len()-1]) // we don't want the newline character
379380
}
380-
logX(level|LogConsoleOnly, s)
381+
logX(level|LogNotToFile, s)
381382
fd := accessLogFile.Load()
382383
fd.Write(bts.Bytes())
383384
}

0 commit comments

Comments
 (0)