Class: Lumberjack::Device::Null

Inherits:
Lumberjack::Device show all
Defined in:
lib/lumberjack/device/null.rb

Overview

A logging device that discards all output. This device provides a silent logging implementation useful for testing environments, performance benchmarks, or production scenarios where logging needs to be temporarily disabled without changing logger configuration.

The Null device implements the complete Device interface but performs no actual operations, making it both efficient and transparent. It accepts any constructor arguments for compatibility but ignores them all.

Examples:

Creating a silent logger

logger = Lumberjack::Logger.new(Lumberjack::Device::Null.new)
logger.info("This message is discarded")

Using the convenience constructor

logger = Lumberjack::Logger.new(:null)
logger.error("This error is also discarded")

Instance Method Summary collapse

Methods inherited from Lumberjack::Device

#close, #datetime_format, #datetime_format=, #dev, #flush, open_device, #reopen

Constructor Details

#initialize(*args) ⇒ Null

Returns a new instance of Null.



23
24
# File 'lib/lumberjack/device/null.rb', line 23

def initialize(*args)
end

Instance Method Details

#write(entry) ⇒ void

This method returns an undefined value.

Discard the log entry without performing any operation.

Parameters:



30
31
# File 'lib/lumberjack/device/null.rb', line 30

def write(entry)
end