Skip to main content

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 the Logger 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 the output field.
  • Parameters:
    • l: Pointer to the mockLogger 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 the output field.
  • Parameters:
    • l: Pointer to the mockLogger 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