Class: Filbunke::Logger
- Inherits:
-
Object
- Object
- Filbunke::Logger
- Defined in:
- lib/filbunke/logger.rb
Instance Method Summary collapse
-
#initialize(log_file_name, local) ⇒ Logger
constructor
A new instance of Logger.
- #log(msg) ⇒ Object
Constructor Details
#initialize(log_file_name, local) ⇒ Logger
Returns a new instance of Logger.
4 5 6 7 |
# File 'lib/filbunke/logger.rb', line 4 def initialize(log_file_name, local) @local = local @log_file = ::File.open(log_file_name, "a") unless local end |
Instance Method Details
#log(msg) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/filbunke/logger.rb', line 9 def log(msg) if @local then puts "#{Time.now}: #{msg}" else @log_file.write("#{Time.now}: #{msg}\n") @log_file.flush end end |