Module: Faye::Logging
Constant Summary collapse
- DEFAULT_LOG_LEVEL =
:error
- LOG_LEVELS =
{ :error => 3, :warn => 2, :info => 1, :debug => 0 }
Class Attribute Summary collapse
Instance Attribute Summary collapse
Instance Method Summary collapse
Class Attribute Details
.log_level ⇒ Object
21 22 23 |
# File 'lib/faye/mixins/logging.rb', line 21 def log_level @log_level || DEFAULT_LOG_LEVEL end |
Instance Attribute Details
Instance Method Details
#log(message_args, level) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/faye/mixins/logging.rb', line 32 def log(, level) return unless Faye.logger return if LOG_LEVELS[log_level] > LOG_LEVELS[level] = .shift.gsub(/\?/) do Faye.to_json(.shift) end = Time.now.strftime('%Y-%m-%d %H:%M:%S') = " [#{ level.to_s.upcase }] [#{ self.class.name }] " puts( + + ) end |