Skip to content

Commit 5ed8d4c

Browse files
committed
logging: add method to clone the logger
1 parent 86a9303 commit 5ed8d4c

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

logging/logging.go

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ type ILogger interface {
3333

3434
EnableLevel(level LogLevel)
3535
DisableLevel(level LogLevel)
36+
Clone() ILogger
3637
}
3738

3839
func initLogLevels(maxLevel LogLevel) LogLevel {

logging/simple_logger.go

+4
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,7 @@ func (l *SimpleLogger) EnableLevel(level LogLevel) {
114114
func (l *SimpleLogger) DisableLevel(level LogLevel) {
115115
l.CurLevel &= ^level
116116
}
117+
118+
func (l *SimpleLogger) Clone() ILogger {
119+
return &SimpleLogger{CurLevel: l.CurLevel, NormalLogger: l.NormalLogger, ErrorLogger: l.ErrorLogger, Start: l.Start}
120+
}

0 commit comments

Comments
 (0)