Class: Aoandon::Log
- Inherits:
-
Object
- Object
- Aoandon::Log
- Defined in:
- lib/aoandon/log.rb
Instance Method Summary collapse
-
#initialize(verbose = false) ⇒ Log
constructor
A new instance of Log.
- #message(*args) ⇒ Object
Constructor Details
#initialize(verbose = false) ⇒ Log
Returns a new instance of Log.
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/aoandon/log.rb', line 3 def initialize(verbose = false) @file = if File.exist?('log/aoandon.yml') File.open('log/aoandon.yml', 'a') else File.open('/var/log/aoandon.yml', 'a') end @verbose = verbose puts "Log file: #{File.(@file.path)}" end |
Instance Method Details
#message(*args) ⇒ Object
15 16 17 18 19 |
# File 'lib/aoandon/log.rb', line 15 def (*args) puts args.compact.map(&:to_s).join(' | ') if @verbose @file.puts "- #{args.compact.map(&:to_s)}" @file.flush end |