module MailyHerald::Logging
Constants
- OPTIONS
Public Class Methods
initialize(opts = {})
click to toggle source
# File lib/maily_herald/logging.rb, line 47 def self.initialize(opts = {}) oldlogger = @logger @options ||= OPTIONS.dup @options.merge!(opts) if opts @options[:target] = Rails.root + @options[:target] if @options[:target].is_a?(String) && Pathname.new(@options[:target]).relative? && defined?(Rails) @logger = Logger.new(@options[:target]) @logger.level = @options[:level] @logger.formatter = Formatter.new @logger.progname = @options[:progname] @logger.extend(LoggerExtensions) oldlogger.close if oldlogger @logger end
initialized?()
click to toggle source
# File lib/maily_herald/logging.rb, line 65 def self.initialized? !!@logger end
logger(opts = {})
click to toggle source
# File lib/maily_herald/logging.rb, line 69 def self.logger opts = {} @logger || initialize(opts) end
logger=(log)
click to toggle source
# File lib/maily_herald/logging.rb, line 73 def self.logger=(log) @logger = (log ? log : Logger.new('/dev/null')) end
options()
click to toggle source
# File lib/maily_herald/logging.rb, line 77 def self.options @options || OPTIONS.dup end
safe_options()
click to toggle source
# File lib/maily_herald/logging.rb, line 81 def self.safe_options opts = self.options.dup opts[:target] = nil if !opts[:target].is_a?(String) opts end
Public Instance Methods
logger()
click to toggle source
# File lib/maily_herald/logging.rb, line 87 def logger MailyHerald::Logging.logger end