Class: GreenPepper::Logger
- Inherits:
-
Object
- Object
- GreenPepper::Logger
- Defined in:
- lib/greenpepper/logger.rb
Overview
Very very simple logger.
Instance Method Summary collapse
-
#close ⇒ Object
Close the log file.
-
#error(message) ⇒ Object
Prints to the output.
- #get_log_path ⇒ Object
-
#initialize(output) ⇒ Logger
constructor
A new instance of Logger.
-
#log(message) ⇒ Object
Print to log file.
- #log_error(message) ⇒ Object
Constructor Details
#initialize(output) ⇒ Logger
Returns a new instance of Logger.
9 10 11 12 13 14 15 |
# File 'lib/greenpepper/logger.rb', line 9 def initialize(output) @output = output log_file = get_log_path @output_file = File.open(log_file, 'a') end |
Instance Method Details
#close ⇒ Object
Close the log file
41 42 43 |
# File 'lib/greenpepper/logger.rb', line 41 def close @output_file.close end |
#error(message) ⇒ Object
Prints to the output
26 27 28 |
# File 'lib/greenpepper/logger.rb', line 26 def error() @output.puts end |
#get_log_path ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/greenpepper/logger.rb', line 17 def get_log_path if /win32/ === RUBY_PLATFORM "C:/temp/greenpepperruby.log" else "/tmp/greenpepperruby.log" end end |
#log(message) ⇒ Object
Print to log file
31 32 33 |
# File 'lib/greenpepper/logger.rb', line 31 def log() @output_file.puts if @output_file end |
#log_error(message) ⇒ Object
35 36 37 38 |
# File 'lib/greenpepper/logger.rb', line 35 def log_error() error log end |