Class: Patch::Log
- Inherits:
-
Object
- Object
- Patch::Log
- Defined in:
- lib/patch/log.rb
Overview
Logging
Instance Method Summary collapse
-
#exception(exception) ⇒ String
(also: #error)
Output an exception.
-
#initialize(out, options = {}) ⇒ Log
constructor
A new instance of Log.
- #path ⇒ Object
-
#puts(message) ⇒ String
(also: #info)
Output an info message.
-
#time ⇒ Time
The current time since startup.
Constructor Details
#initialize(out, options = {}) ⇒ Log
Returns a new instance of Log.
9 10 11 12 13 |
# File 'lib/patch/log.rb', line 9 def initialize(out, = {}) @out = out @start = Time.now populate_level() end |
Instance Method Details
#exception(exception) ⇒ String Also known as: error
Output an exception
38 39 40 41 42 43 44 |
# File 'lib/patch/log.rb', line 38 def exception(exception) if @exception = format(exception., :type => :exception) @out.puts() end exception end |
#path ⇒ Object
15 16 17 |
# File 'lib/patch/log.rb', line 15 def path @out.path end |
#puts(message) ⇒ String Also known as: info
Output an info message
28 29 30 31 32 |
# File 'lib/patch/log.rb', line 28 def puts() = format(, :type => :info) @out.puts() if @info end |
#time ⇒ Time
The current time since startup
21 22 23 |
# File 'lib/patch/log.rb', line 21 def time Time.now - @start end |