Class: Madeleine::Logger
- Inherits:
-
Object
- Object
- Madeleine::Logger
- Defined in:
- lib/madeleine.rb
Overview
:nodoc:
Instance Method Summary collapse
- #close ⇒ Object
- #ensure_directory_exists ⇒ Object
-
#initialize(directory_name, log_factory) ⇒ Logger
constructor
A new instance of Logger.
- #internal_store(command) ⇒ Object
- #reset ⇒ Object
- #store(command) ⇒ Object
Constructor Details
#initialize(directory_name, log_factory) ⇒ Logger
Returns a new instance of Logger.
319 320 321 322 323 324 325 |
# File 'lib/madeleine.rb', line 319 def initialize(directory_name, log_factory) @directory_name = directory_name @log_factory = log_factory @log = nil @pending_tick = nil ensure_directory_exists end |
Instance Method Details
#close ⇒ Object
357 358 359 360 361 |
# File 'lib/madeleine.rb', line 357 def close return if @log.nil? @log.close @log = nil end |
#ensure_directory_exists ⇒ Object
327 328 329 330 331 |
# File 'lib/madeleine.rb', line 327 def ensure_directory_exists unless File.exist?(@directory_name) FileUtils.mkpath(@directory_name) end end |
#internal_store(command) ⇒ Object
350 351 352 353 354 355 |
# File 'lib/madeleine.rb', line 350 def internal_store(command) if @log.nil? open_new_log end @log.store(command) end |
#reset ⇒ Object
333 334 335 336 |
# File 'lib/madeleine.rb', line 333 def reset close delete_log_files end |