module DiasporaFederation::Logging

Logging module for the diaspora* federation

It uses the logging-gem if available.

Public Class Methods

included(klass) click to toggle source

Add logger also as class method when included @param [Class] klass the class into which the module is included

# File lib/diaspora_federation/logging.rb, line 10
def self.included(klass)
  klass.extend(self)
end

Private Instance Methods

logger() click to toggle source

Get the logger for this class

Use the logging-gem if available, else use a default logger.

# File lib/diaspora_federation/logging.rb, line 19
def logger
  @logger ||= if defined?(::Logging::Logger)
                # Use logging-gem if available
                ::Logging::Logger[self]
              elsif defined?(::Rails)
                # Use rails logger if running in rails and no logging-gem is available
                ::Rails.logger
              else
                # fallback logger
                @logger = Logger.new($stdout)
                @logger.level = Logger::INFO
                @logger
              end
end