Class: Translatomatic::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/translatomatic/logger.rb

Overview

Logging

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTranslatomatic::Logger



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

#progressbarProgressBar



5
6
7
# File 'lib/translatomatic/logger.rb', line 5

def progressbar
  @progressbar
end

Instance Method Details

#finishObject

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