Class: Translatomatic::Logger
- Inherits:
-
Object
- Object
- Translatomatic::Logger
- Defined in:
- lib/translatomatic/logger.rb
Overview
Logging
Instance Attribute Summary collapse
-
#progressbar ⇒ ProgressBar
A progress bar.
Instance Method Summary collapse
-
#finish ⇒ Object
Called at the end of translatomatic to clear the progress bar.
-
#initialize ⇒ Translatomatic::Logger
constructor
Create a new logger instance.
Constructor Details
#initialize ⇒ Translatomatic::Logger
Returns create a new logger instance.
8 9 10 11 12 13 14 |
# File 'lib/translatomatic/logger.rb', line 8 def initialize @logger = Logger.new(STDOUT) @logger.level = ENV['DEBUG'] ? Logger::DEBUG : Logger::INFO @logger.formatter = proc do |severity, datetime, progname, msg| "#{msg}\n" end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object (private)
26 27 28 |
# File 'lib/translatomatic/logger.rb', line 26 def method_missing(name, *args) handle_logger_method(name, args) if @logger.respond_to?(name) end |
Instance Attribute Details
#progressbar ⇒ ProgressBar
Returns A progress bar.
5 6 7 |
# File 'lib/translatomatic/logger.rb', line 5 def @progressbar end |
Instance Method Details
#finish ⇒ Object
Called at the end of translatomatic to clear the progress bar.
17 18 19 20 21 22 |
# File 'lib/translatomatic/logger.rb', line 17 def finish @finished ||= begin @progressbar.finish if @progressbar true end end |