Parent

Rackamole::Store::Log

Public Class Methods

new( file_name=$stdout ) click to toggle source

Stores mole information to a log file or dump it to the console. All available mole info will dumped to the logger.

Params:

file_name

Specifies a file to send the logs to. By default mole info

will be sent out to stdout.

    # File lib/rackamole/store/log.rb, line 10
10:     def initialize( file_name=$stdout )
11:       @logger = Rackamole::Logger.new( :log_file => file_name )
12:     end

Public Instance Methods

mole( attrs ) click to toggle source

Dump mole info to logger

Params:

attrs

The available moled information for a given feature

    # File lib/rackamole/store/log.rb, line 18
18:     def mole( attrs )
19:       return if attrs.empty?
20:               
21:       display_head( attrs )
22:       display_commons( attrs )          
23:     rescue => mole_boom
24:       log.error "MOLE STORE CRAPPED OUT -- #{mole_boom}"
25:       log.error mole_boom.backtrace.join( "\n   " )        
26:     end

Private Instance Methods

display_commons( args ) click to toggle source

dump moled info to log

    # File lib/rackamole/store/log.rb, line 32
32:       def display_commons( args )
33:         args.each do |k,v|
34:           display_info( k.to_s.capitalize, v.inspect )
35:         end
36:       end
display_head( args ) click to toggle source

Display mole type

    # File lib/rackamole/store/log.rb, line 47
47:       def display_head( args )
48:         log.info "-"*100
49:         log.info case args[:type]
50:           when Rackamole.feature 
51:             "FEATURE"
52:           when Rackamole.fault
53:             "FAULT"
54:           when Rackamole.perf
55:             "PERFORMANCE"
56:         end
57:       end
display_info( key, value ) click to toggle source

Output formating...

    # File lib/rackamole/store/log.rb, line 60
60:       def display_info( key, value )
61:         log.info "%-#{spacer}s : %s" % [key, value]
62:       end
log() click to toggle source

retrieves logger instance

    # File lib/rackamole/store/log.rb, line 39
39:       def log
40:         @logger
41:       end
spacer() click to toggle source

Console layout spacer

    # File lib/rackamole/store/log.rb, line 44
44:       def spacer() 20; end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.