Class: Chronos::Internal::SafeLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/chronos/internal/safe_logger.rb

Overview

Protects the host application from logger failures and recursive diagnostics.

Examples:

logger.warn("transport failed")

Constant Summary collapse

MAX_MESSAGE_BYTES =
1024

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ SafeLogger

Returns a new instance of SafeLogger.



15
16
17
18
19
# File 'lib/chronos/internal/safe_logger.rb', line 15

def initialize(logger)
  @logger = logger
  @mutex = Mutex.new
  @logging = false
end

Instance Method Details

#debug(message) ⇒ Object



21
22
23
# File 'lib/chronos/internal/safe_logger.rb', line 21

def debug(message)
  write(:debug, message)
end

#warn(message) ⇒ Object



25
26
27
# File 'lib/chronos/internal/safe_logger.rb', line 25

def warn(message)
  write(:warn, message)
end