Sha256: 6cf5448f98c8b80d0413fab4c9739993d8fea219dd64393687d7039412c0fd7d
Contents?: true
Size: 1.48 KB
Versions: 4
Compression:
Stored size: 1.48 KB
Contents
module Rackamole module Store # Logger adapter. Stores mole information to a log file or dump it to stdout class Log def initialize( file_name=$stdout ) @logger = Rackamole::Logger.new( :log_file => file_name ) end # Dump mole info to logger def mole( args ) return if args.empty? if args[:stack] display_head "MOLED EXCEPTION" elsif args[:performance] display_head "MOLED PERFORMANCE" else display_head "MOLED FEATURE" end display_commons( args ) rescue => mole_boom log.error "MOLE STORE CRAPPED OUT -- #{mole_boom}" log.error mole_boom.backtrace.join( "\n " ) end # ======================================================================= private # dump moled info to log def display_commons( args ) args.each do |k,v| display_info( k.to_s.capitalize, v.inspect ) end end # retrieves logger instance def log @logger end # Console layout spacer def spacer() 20; end # Display mole type def display_head( msg ) log.info "-"*100 log.info msg end # Output formating... def display_info( key, value ) log.info "%-#{spacer}s : %s" % [key, value] end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rackamole-0.0.6 | lib/rackamole/store/log.rb |
rackamole-0.0.4 | lib/rackamole/store/log.rb |
rackamole-0.0.3 | lib/rackamole/store/log.rb |
rackamole-0.0.2 | lib/rackamole/store/log.rb |