Module Facebooker::Logging
In: lib/facebooker/logging.rb

Methods

Attributes

skip_api_logging  [RW] 

Public Class methods

[Source]

# File lib/facebooker/logging.rb, line 33
    def self.format_fb_params(params)
      params.map { |key,value| "#{key} = #{value}" }.join(', ')
    end

[Source]

# File lib/facebooker/logging.rb, line 15
    def self.log_fb_api(method, params)
      message = method # might customize later
      dump = format_fb_params(params)
      if block_given?
        result = nil
        seconds = Benchmark.realtime { result = yield }
        log_info(message, dump, seconds) unless skip_api_logging
        result
      else
        log_info(message, dump) unless skip_api_logging
        nil
      end
    rescue Exception => e
      exception = "#{e.class.name}: #{e.message}: #{dump}"
      log_info(message, exception)
      raise
    end

[Source]

# File lib/facebooker/logging.rb, line 37
    def self.log_info(message, dump, seconds = 0)
      return unless Facebooker.logger
      log_message = "#{message} (#{seconds}) #{dump}"
      Facebooker.logger.info(log_message)
    end

[Validate]