module Docman::Logging
Public Class Methods
logger()
click to toggle source
# File lib/docman/logging.rb, line 8 def self.logger @logger ||= Logger.new(STDOUT) end
Public Instance Methods
log(message, type = 'debug')
click to toggle source
# File lib/docman/logging.rb, line 33 def log(message, type = 'debug') if type == 'debug' if Application::instance.options.respond_to?('has_key') and Application::instance.options.has_key?('debug') logger.send(type, "#{prefix} - #{message}") end else logger.send(type, "#{prefix} - #{message}") end end
logger()
click to toggle source
# File lib/docman/logging.rb, line 4 def logger Logging.logger end
prefix()
click to toggle source
# File lib/docman/logging.rb, line 43 def prefix end
properties_info(properties = [])
click to toggle source
# File lib/docman/logging.rb, line 12 def properties_info(properties = []) arr = ["name=#{self.class.name}"] properties.each do |property| if self.is_a? Hash arr << "#{property}=#{self[property]}" if self.include?(property) else arr << "#{property}=#{self.send(property)}" if self.respond_to?(property) end end arr.join(', ') end
with_logging(message = nil, type = 'debug') { || ... }
click to toggle source
# File lib/docman/logging.rb, line 24 def with_logging(message = nil, type = 'debug') # logger.send(type, "#{prefix} - #{message} - start") if @log log("#{message} - start", type) result = yield log("#{message} - finish", type) # logger.send(type, "#{prefix} - #{message} - finish") if @log result end