Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
utils
Overview
Overview
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
golang kittool
utils
Commits
1611f1da
Commit
1611f1da
authored
Mar 30, 2022
by
feidy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update logger
parent
0603f3c6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
logger.go
logger.go
+4
-4
No files found.
logger.go
View file @
1611f1da
...
...
@@ -36,7 +36,7 @@ type loggerConfig struct {
MaxBackups
int
MaxAge
int
Compress
bool
Ostd
bool
Console
bool
}
type
loggerOption
func
(
m
*
loggerConfig
)
...
...
@@ -77,9 +77,9 @@ func WithCompress(compress bool) loggerOption {
}
}
func
With
Ostd
(
isOstd
bool
)
loggerOption
{
func
With
WithConsole
(
isConsole
bool
)
loggerOption
{
return
func
(
m
*
loggerConfig
)
{
m
.
Ostd
=
isOstd
m
.
Console
=
isConsole
}
}
...
...
@@ -103,7 +103,7 @@ func InitLogger(opt ...loggerOption) {
writeSync
:=
getLogWriter
()
encoder
:=
getEncoder
()
var
core
zapcore
.
Core
if
lf
.
Ostd
{
if
lf
.
Console
{
consoleDebugging
:=
zapcore
.
Lock
(
os
.
Stdout
)
core
=
zapcore
.
NewTee
(
zapcore
.
NewCore
(
encoder
,
writeSync
,
zapcore
.
Level
(
lf
.
Level
)),
...
...
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