class NullLogger

Null logger class. This is essentially the same as sending data down the `/dev/null` black hole.

@example Basic Usage

logger = NullLogger.new
Rails.logger = logger

@example Basic Pattern Usage

class SomeService
  def initialize(options = {})
    @logger = options[:logger] || NullLogger.new
  end

  def perform
    @logger.debug -> { "do some work here" }
    # .. ..
    @logger.info -> { "finished working" }
  end
end

service = SomeService.new(logger: Logger.new(STDOUT))
service.perform

silent = SomeService.new(logger: NullLogger.new
silent.perform

Constants

VERSION

null-logger gem Version

Public Instance Methods

debug(*_args) click to toggle source

@param _args Anything that we want to ignore @return [nil]

# File lib/null_logger.rb, line 84
def debug(*_args)
  nil
end
debug?() click to toggle source

@return [FALSE]

# File lib/null_logger.rb, line 89
def debug?
  false
end
error(*_args) click to toggle source

@param _args Anything that we want to ignore @return [nil]

# File lib/null_logger.rb, line 51
def error(*_args)
  nil
end
error?() click to toggle source

@return [FALSE]

# File lib/null_logger.rb, line 56
def error?
  false
end
fatal(*_args) click to toggle source

@param _args Anything that we want to ignore @return [nil]

# File lib/null_logger.rb, line 40
def fatal(*_args)
  nil
end
fatal?() click to toggle source

@return [FALSE]

# File lib/null_logger.rb, line 45
def fatal?
  false
end
info(*_args) click to toggle source

@param _args Anything that we want to ignore @return [nil]

# File lib/null_logger.rb, line 73
def info(*_args)
  nil
end
info?() click to toggle source

@return [FALSE]

# File lib/null_logger.rb, line 78
def info?
  false
end
unknown(*_args) click to toggle source

@param _args Anything that we want to ignore @return [nil]

# File lib/null_logger.rb, line 34
def unknown(*_args)
  nil
end
warn(*_args) click to toggle source

@param _args Anything that we want to ignore @return [nil]

# File lib/null_logger.rb, line 62
def warn(*_args)
  nil
end
warn?() click to toggle source

@return [FALSE]

# File lib/null_logger.rb, line 67
def warn?
  false
end