Module: Shoryuken::Logging

Defined in:
lib/shoryuken/logging.rb,
lib/shoryuken/logging/base.rb,
lib/shoryuken/logging/pretty.rb,
lib/shoryuken/logging/without_timestamp.rb

Defined Under Namespace

Classes: Base, Pretty, WithoutTimestamp

Class Method Summary collapse

Class Method Details

.initialize_logger(log_target = STDOUT) ⇒ Object



19
20
21
22
23
24
# File 'lib/shoryuken/logging.rb', line 19

def self.initialize_logger(log_target = STDOUT)
  @logger = Logger.new(log_target)
  @logger.level = Logger::INFO
  @logger.formatter = Pretty.new
  @logger
end

.loggerObject



26
27
28
# File 'lib/shoryuken/logging.rb', line 26

def self.logger
  @logger ||= initialize_logger
end

.logger=(log) ⇒ Object



30
31
32
# File 'lib/shoryuken/logging.rb', line 30

def self.logger=(log)
  @logger = log || Logger.new('/dev/null')
end

.with_context(msg) ⇒ Object



12
13
14
15
16
17
# File 'lib/shoryuken/logging.rb', line 12

def self.with_context(msg)
  Thread.current[:shoryuken_context] = msg
  yield
ensure
  Thread.current[:shoryuken_context] = nil
end