Module: TwitterFriendly::Logging
- Included in:
- ASLogSubscriber, TFLogSubscriber
- Defined in:
- lib/twitter_friendly/log_subscriber.rb
Class Method Summary collapse
- .logger ⇒ Object
-
.logger=(logger) ⇒ Object
Because TwitterFriendly::Logging is not inherited, passing an instance of logger via module function.
Instance Method Summary collapse
Class Method Details
.logger ⇒ Object
20 21 22 |
# File 'lib/twitter_friendly/log_subscriber.rb', line 20 def logger @@logger end |
.logger=(logger) ⇒ Object
Because TwitterFriendly::Logging is not inherited, passing an instance of logger via module function.
25 26 27 |
# File 'lib/twitter_friendly/log_subscriber.rb', line 25 def logger=(logger) @@logger = logger end |
Instance Method Details
#truncated_payload(payload) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/twitter_friendly/log_subscriber.rb', line 3 def truncated_payload(payload) return '' if payload.empty? return payload.inspect if !payload.has_key?(:args) || !payload[:args].is_a?(Array) || payload[:args].empty? || !payload[:args][0].is_a?(Array) args = payload[:args].dup args[0] = if args[0].size > 3 "[#{args[0].take(3).join(', ')} ... #{args[0].size}]" else args[0].inspect end {args: args}.merge(payload.except(:args)).inspect end |