Class: Filum::Logger
- Inherits:
-
Logger
- Object
- Logger
- Filum::Logger
- Defined in:
- lib/filum/logger.rb
Instance Attribute Summary collapse
-
#logfile ⇒ Object
readonly
Returns the value of attribute logfile.
Instance Method Summary collapse
- #context_id=(context_id) ⇒ Object
- #end_timing(label) ⇒ Object
-
#initialize(logfile, options = {}) ⇒ Logger
constructor
A new instance of Logger.
- #start_timing(label) ⇒ Object
Constructor Details
#initialize(logfile, options = {}) ⇒ Logger
Returns a new instance of Logger.
9 10 11 12 13 14 15 16 17 |
# File 'lib/filum/logger.rb', line 9 def initialize(logfile, = {}) @timings = {} @logfile = logfile create_log_directory super(logfile, shift_age='daily') self.formatter = Filum::LogFormatter.new() self.level = Logger::INFO end |
Instance Attribute Details
#logfile ⇒ Object (readonly)
Returns the value of attribute logfile.
7 8 9 |
# File 'lib/filum/logger.rb', line 7 def logfile @logfile end |
Instance Method Details
#context_id=(context_id) ⇒ Object
19 20 21 |
# File 'lib/filum/logger.rb', line 19 def context_id=(context_id) Thread.current[:context_id] = context_id end |
#end_timing(label) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/filum/logger.rb', line 28 def end_timing(label) finish = Time.now if @timings[label] info("Stopped timing for #{label} at #{@timings[label]}, #{(finish.to_f - @timings[label].to_f).round(3)}") @timings.delete(label) else info("Stopped timing for #{label} at #{@timings[label]}, no start time found") end end |
#start_timing(label) ⇒ Object
23 24 25 26 |
# File 'lib/filum/logger.rb', line 23 def start_timing(label) @timings[label] = Time.now info("Started timing for #{label} at #{@timings[label]}") end |