Class: Skylight::Core::Util::AlertLogger Private

Inherits:
Object
  • Object
show all
Defined in:
lib/skylight/core/util/logging.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Log both to the specified logger and STDOUT

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ AlertLogger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of AlertLogger.



7
8
9
# File 'lib/skylight/core/util/logging.rb', line 7

def initialize(logger)
  @logger = logger
end

Instance Method Details

#closeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
# File 'lib/skylight/core/util/logging.rb', line 22

def close; end

#write(*args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
14
15
16
17
18
19
20
# File 'lib/skylight/core/util/logging.rb', line 11

def write(*args)
  STDERR.write(*args)

  # Try to avoid writing to STDOUT/STDERR twice
  logger_logdev = @logger.instance_variable_get(:@logdev)
  logger_out = logger_logdev && logger_logdev.respond_to?(:dev) ? logger_logdev.dev : nil
  if logger_out != STDOUT && logger_out != STDERR
    @logger.<<(*args)
  end
end