Class: Translatomatic::Logger

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLogger

Returns a new instance of Logger.



4
5
6
7
8
9
10
# File 'lib/translatomatic/logger.rb', line 4

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



12
13
14
# File 'lib/translatomatic/logger.rb', line 12

def method_missing(name, *args)
  handle_logger_method(name, args) if @logger.respond_to?(name)
end

Instance Attribute Details

#progressbarObject

Returns the value of attribute progressbar.



2
3
4
# File 'lib/translatomatic/logger.rb', line 2

def progressbar
  @progressbar
end

Instance Method Details

#finishObject



16
17
18
# File 'lib/translatomatic/logger.rb', line 16

def finish
  @progressbar.finish if @progressbar
end