Module: Krakow::Utils::Logging

Included in:
Lazy
Defined in:
lib/krakow/utils/logging.rb

Overview

Logging helpers

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.level=(level) ⇒ Integer?

Set the logging output level

Parameters:

  • level (Integer)

Returns:

  • (Integer, nil)


34
35
36
37
38
# File 'lib/krakow/utils/logging.rb', line 34

def level=(level)
  if(Celluloid.logger.class == Logger)
    Celluloid.logger.level = Logger.const_get(level.to_s.upcase.to_sym)
  end
end

Instance Method Details

#log(*args) ⇒ Logger?

Log message

Parameters:

  • args (Array, nil)

Returns:

  • (Logger, nil)


19
20
21
22
23
24
25
26
27
# File 'lib/krakow/utils/logging.rb', line 19

def log(*args)
  if(args.empty?)
    Celluloid::Logger
  else
    severity, string = args
    Celluloid::Logger.send(severity.to_sym, "#{self}: #{string}")
    nil
  end
end