logger_test.go
logger_test.go - Overview
This file contains unit tests for the logging functionality in BadgerDB, specifically focusing on ensuring the correct logger (DB-specific or global) is used.
Detailed Documentation
type mockLogger
type mockLogger struct {
output string
}
- Purpose:
mockLogger
is a mock implementation of theLogger
interface used for testing. - Fields:
output
: Stores the last log message.
func (l *mockLogger) Errorf
func (l *mockLogger) Errorf(f string, v ...interface{})
- Purpose: Mock implementation of
Errorf
that stores the formatted message in theoutput
field. - Parameters:
l
: Pointer to themockLogger
struct.f
: The format string for the log message.v
: Variadic arguments to be formatted into the log message.
func (l *mockLogger) Infof
func (l *mockLogger) Infof(f string, v ...interface{})
- Purpose: Mock implementation of
Infof
that stores the formatted message in theoutput
field. - Parameters:
l
: Pointer to themockLogger
struct.f
: The format string for the log message.v
: Variadic arguments to be formatted into the log message.
func (l *mockLogger) Warningf
func (l *mockLogger) Warningf