Method: Nanite::Log.init

Defined in:
lib/nanite/log.rb

.init(identity = nil, path = false) ⇒ Object

Use Nanite::Logger.init when you want to set up the logger manually. If this method is called with no arguments, it will log to STDOUT at the :info level. It also configures the Logger instance it creates to use the custom Nanite::Log::Formatter class.



16
17
18
19
20
21
22
23
24
25
# File 'lib/nanite/log.rb', line 16

def init(identity = nil, path = false)
  if path
    @file = File.join(path, "nanite.#{identity}.log")
  else
    @file = STDOUT
  end
  @logger = Logger.new(file)
  @logger.formatter = Nanite::Log::Formatter.new
  level = @log_level = :info
end