Class: Dumper::Logger
- Inherits:
-
Object
- Object
- Dumper::Logger
- Defined in:
- lib/dumper/logger.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.log_on_file(file, data) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/dumper/logger.rb', line 29 def log_on_file(file, data) File.open(file, ?a) do |file| data.each do |status, | file.puts status == :critical_error_dump ? .inspect : end end end |
.log_on_screen(data) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/dumper/logger.rb', line 37 def log_on_screen(data) data.each do |status, | if status == :critical_error_dump p else puts end end end |
.redirect_on(where, file) ⇒ Object
24 25 26 27 |
# File 'lib/dumper/logger.rb', line 24 def redirect_on(where, file) @@where = where @@file = !file || file.empty? ? 'dumper.log' : file end |
Instance Method Details
#update(data) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/dumper/logger.rb', line 48 def update(data) if @@where == :file Logger.log_on_file @@file, data else Logger.log_on_screen(data) if Dumper.verbose? end end |