Skip to content

Commit b66cd61

Browse files
committed
Add SetLevel and With methods to MockLogger
1 parent 96549fa commit b66cd61

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mocklogger/mocklogger.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,18 @@ func (m *MockLogger) GetLogLevel() logger.LogLevel {
3737
return logger.LogLevelNone // Return LogLevelNone if no specific log level is set
3838
}
3939

40+
// SetLevel sets the logging level of the MockLogger.
41+
// This controls the verbosity of the logger, allowing it to filter out logs below the set level.
4042
func (m *MockLogger) SetLevel(level logger.LogLevel) {
4143
m.logLevel = level
4244
m.Called(level)
4345
}
4446

47+
// With adds contextual key-value pairs to the MockLogger and returns a new logger instance with this context.
48+
// This is useful for adding common fields to all subsequent logs produced by the logger.
4549
func (m *MockLogger) With(fields ...zapcore.Field) logger.Logger {
4650
m.Called(fields)
47-
// This is a mock implementation; adjust as necessary for your tests
51+
4852
return m
4953
}
5054

0 commit comments

Comments
 (0)