Class: Pork::Log
- Inherits:
-
Object
- Object
- Pork::Log
- Defined in:
- lib/pork_sandwich/log.rb
Instance Attribute Summary collapse
-
#log ⇒ Object
Returns the value of attribute log.
-
#output ⇒ Object
Returns the value of attribute output.
-
#project ⇒ Object
Returns the value of attribute project.
-
#researcher ⇒ Object
Returns the value of attribute researcher.
Instance Method Summary collapse
-
#initialize(output, options = {}) ⇒ Log
constructor
A new instance of Log.
- #write(message) ⇒ Object
Constructor Details
#initialize(output, options = {}) ⇒ Log
Returns a new instance of Log.
5 6 7 8 9 10 |
# File 'lib/pork_sandwich/log.rb', line 5 def initialize(output, = {}) @log = Logger.new(output) @log.level = Logger::INFO @researcher = [:researcher]? [:researcher] : nil @project = [:project]? [:project] : nil end |
Instance Attribute Details
#log ⇒ Object
Returns the value of attribute log.
3 4 5 |
# File 'lib/pork_sandwich/log.rb', line 3 def log @log end |
#output ⇒ Object
Returns the value of attribute output.
3 4 5 |
# File 'lib/pork_sandwich/log.rb', line 3 def output @output end |
#project ⇒ Object
Returns the value of attribute project.
3 4 5 |
# File 'lib/pork_sandwich/log.rb', line 3 def project @project end |
#researcher ⇒ Object
Returns the value of attribute researcher.
3 4 5 |
# File 'lib/pork_sandwich/log.rb', line 3 def researcher @researcher end |
Instance Method Details
#write(message) ⇒ Object
12 13 14 |
# File 'lib/pork_sandwich/log.rb', line 12 def write() @log.info("#{@project ? @project + ', ' : ''}#{@researcher ? @researcher + ', ' : ''}#{Time.now.to_s} -- " + ) end |