Class: DBGeni::Logger
- Inherits:
-
Object
- Object
- DBGeni::Logger
- Defined in:
- lib/dbgeni/logger.rb
Class Method Summary collapse
Instance Method Summary collapse
- #close ⇒ Object
-
#detailed_log_dir ⇒ Object
This could be done in the initialize block, but then even for non destructive commands, there would be a detailed log dir created, so only create the dir when the directory is asked for.
- #error(msg) ⇒ Object
- #info(msg) ⇒ Object
- #reset_detailed_log_dir ⇒ Object
Class Method Details
.instance(location = nil) ⇒ Object
5 6 7 |
# File 'lib/dbgeni/logger.rb', line 5 def self.instance(location=nil) @@singleton_instance ||= self.new(location) end |
Instance Method Details
#close ⇒ Object
17 18 19 20 21 22 |
# File 'lib/dbgeni/logger.rb', line 17 def close if @fh && !@fh.closed? @fh.close end @@singleton_instance = nil end |
#detailed_log_dir ⇒ Object
This could be done in the initialize block, but then even for non destructive commands, there would be a detailed log dir created, so only create the dir when the directory is asked for.
27 28 29 30 |
# File 'lib/dbgeni/logger.rb', line 27 def detailed_log_dir FileUtils.mkdir_p(File.join(@log_location, @detailed_log_dir)) File.join(@log_location, @detailed_log_dir) end |
#error(msg) ⇒ Object
13 14 15 |
# File 'lib/dbgeni/logger.rb', line 13 def error(msg) write_msg("ERROR - #{msg}") end |
#info(msg) ⇒ Object
9 10 11 |
# File 'lib/dbgeni/logger.rb', line 9 def info(msg) write_msg(msg) end |
#reset_detailed_log_dir ⇒ Object
32 33 34 |
# File 'lib/dbgeni/logger.rb', line 32 def reset_detailed_log_dir @detailed_log_dir = Time.now.strftime('%Y%m%d%H%M%S') end |