Class: Minimo::Logger

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

Instance Method Summary collapse

Constructor Details

#initialize(dir, level = ::Logger::INFO) ⇒ Logger

Returns a new instance of Logger.



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

def initialize(dir, level = ::Logger::INFO)
  @dir, @level = dir, level
end

Instance Method Details

#write(msg) ⇒ Object



9
10
11
12
13
14
# File 'lib/minimo/logger.rb', line 9

def write(msg)
  logger = ::Logger.new(File.new("#{@dir}/minimo.log", 'a+'), 'daily')
  logger.level = @level
  logger.info msg
  logger.close
end