module PIM::Logging
Constants
- ALL_LOG_LEVELS
- DEFAULT_JAVA_LOGGER_LOG_LEVEL
- DEFAULT_JAVA_PIM_LOG_LEVEL
- DEFAULT_LOG_LEVEL
- MAX_BACKTRACE_SIZE
Public Class Methods
default_log_level(level = nil)
click to toggle source
# File pim.rb, line 726 def self.default_log_level level = nil @@default_log_level = level unless level.nil? @@default_log_level ||= DEFAULT_LOG_LEVEL end
Public Instance Methods
java_logger()
click to toggle source
# File pim.rb, line 799 def java_logger return $java_logger end
java_logger_log_level()
click to toggle source
# File pim.rb, line 811 def java_logger_log_level unless java_logger.nil? # Level to log with when java_logger exists level = ($java_logger_log_level || DEFAULT_JAVA_LOGGER_LOG_LEVEL).downcase.to_sym end return level end
java_pim_log_level()
click to toggle source
# File pim.rb, line 819 def java_pim_log_level unless java_logger.nil? level = ($java_pim_log_level || DEFAULT_JAVA_PIM_LOG_LEVEL).downcase.to_sym end return level end
Also aliased as: java_log_level
log_debug(msg, e = nil)
click to toggle source
# File pim.rb, line 761 def log_debug msg, e = nil log!(:debug, msg, e) end
log_debug_object(name, o)
click to toggle source
Helper method to log Array and Hash content line by line.
# File pim.rb, line 734 def log_debug_object name, o PIM.log_debug "#{name}.class=#{o.class}" PIM.log_debug "#{name}=>#{o}<" if PIM.is_array?(o) o.each_with_index do |value, index| log_debug_object "#{name}[#{index}]", value end elsif PIM.is_hash?(o) o.each_pair do |key, value| log_debug_object "#{name}[#{key}]", value end end begin PIM.log_debug "#{name}.to_json=>#{o.to_json}<" rescue Exception => e PIM.log_error "Error calling to_json on '#{name}' for value '#{o}'", e end end
log_error(msg, e = nil)
click to toggle source
# File pim.rb, line 773 def log_error msg, e = nil log!(:error, msg, e) end
log_info(msg, e = nil)
click to toggle source
# File pim.rb, line 765 def log_info msg, e = nil log!(:info, msg, e) end
log_level(level = nil)
click to toggle source
# File pim.rb, line 777 def log_level level = nil return java_pim_log_level if java_pim_log_level @log_level = level if level if @log_level.nil? and self != PIM and self != PIM::Item if self.is_a?(Module) and self.respond_to?(:parent_modules) log_level = self.parent_modules.each { |p| l = p.log_level; return l unless l.nil? } return log_level unless log_level.nil? elsif self.is_a?(Class) and self.respond_to?(:data_module) return self.data_module.log_level else return PIM.log_level end end return @log_level if @log_level and ALL_LOG_LEVELS.include?(@log_level) return Logging.default_log_level if Logging.default_log_level and ALL_LOG_LEVELS.include?(Logging.default_log_level) return :error end
log_trace(msg, e = nil)
click to toggle source
# File pim.rb, line 757 def log_trace msg, e = nil log!(:trace, msg, e) end
log_warn(msg, e = nil)
click to toggle source
# File pim.rb, line 769 def log_warn msg, e = nil log!(:warn, msg, e) end
yakut_logger()
click to toggle source
# File pim.rb, line 803 def yakut_logger unless $yakut_logger_checked $yakut_logger = Logger.const_get(:DEFAULT_LOGGER) if Logger.const_defined?(:DEFAULT_LOGGER) $yakut_logger_checked = true end return $yakut_logger end