Module: Faye::Logging
- Included in:
- Client, Engine::Proxy, Extensible, RackAdapter, Server, Transport
- Defined in:
- lib/faye/mixins/logging.rb
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
16 17 18 |
# File 'lib/faye/mixins/logging.rb', line 16 def log_level @log_level || DEFAULT_LOG_LEVEL end |
Instance Attribute Details
Instance Method Details
#log(message_args, level) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/faye/mixins/logging.rb', line 27 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 }] " Faye.logger.call( + + ) end |