-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[opt] nazalog: windows平台下,日志级别字段不要携带颜色
- Loading branch information
1 parent
4d2aeec
commit 5d45d1d
Showing
3 changed files
with
42 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2024, Chef. All rights reserved. | ||
// https://github.com/q191201771/naza | ||
// | ||
// Use of this source code is governed by a MIT-style license | ||
// that can be found in the License file. | ||
// | ||
// Author: Chef (191201771@qq.com) | ||
|
||
//go:build linux || darwin || netbsd || freebsd || openbsd || dragonfly | ||
// +build linux darwin netbsd freebsd openbsd dragonfly | ||
|
||
package nazalog | ||
|
||
func (l *logger) writeLevelStringIfNeeded(level Level) { | ||
if l.core.option.LevelFlag { | ||
if l.core.console != nil { | ||
l.core.buf.WriteString(levelToColorString[level]) | ||
} else { | ||
l.core.buf.WriteString(levelToString[level]) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2024, Chef. All rights reserved. | ||
// https://github.com/q191201771/naza | ||
// | ||
// Use of this source code is governed by a MIT-style license | ||
// that can be found in the License file. | ||
// | ||
// Author: Chef (191201771@qq.com) | ||
|
||
//go:build windows | ||
// +build windows | ||
|
||
package nazalog | ||
|
||
func (l *logger) writeLevelStringIfNeeded(level Level) { | ||
if l.core.option.LevelFlag { | ||
// windows系统不用写带颜色的日志级别字段 | ||
l.core.buf.WriteString(levelToString[level]) | ||
} | ||
} |