Module: Vital
- Defined in:
- lib/webget_ruby_vital.rb
Instance Method Summary collapse
-
#vital(msg = '', ops = {}) ⇒ Object
Log a message with timestamp, calling class, method name, process info, etc.
-
#vital_open(msg = '', ops = {}) ⇒ Object
Log a message that is intended to open (i.e. begin) a topic.
-
#vital_shut(msg = '', ops = {}) ⇒ Object
Log a message that is intended to shut (i.e. end) a topic.
Instance Method Details
#vital(msg = '', ops = {}) ⇒ Object
Log a message with timestamp, calling class, method name, process info, etc.
Example
vital("hello")
=> logger.info 2010-12-31 class_name method_name process_info ... hello
36 37 38 39 |
# File 'lib/webget_ruby_vital.rb', line 36 def vital(msg='',ops={}) method_name = ops[:method_name]||method_name_of_caller logger.info [Time.stamp,self.class.name,method_name,Process.ps_tdf].join("\t")+"\t"+msg end |
#vital_open(msg = '', ops = {}) ⇒ Object
Log a message that is intended to open (i.e. begin) a topic.
This simply calls vital with “+” prepended to the message, which is our indicator of a new topic.
Example:
vital_open("hello")
=> logger.info 2010-12-31 class_name method_name process_info ... +hello
51 52 53 |
# File 'lib/webget_ruby_vital.rb', line 51 def vital_open(msg='',ops={}) vital('+'+msg,ops.merge({:method_name=>method_name_of_caller})) end |
#vital_shut(msg = '', ops = {}) ⇒ Object
Log a message that is intended to shut (i.e. end) a topic.
This simply calls vital with “+” prepended to the message, which is our indicator of a new topic.
Example:
vital_open("hello")
=> logger.info 2010-12-31 class_name method_name process_info ... -hello
65 66 67 |
# File 'lib/webget_ruby_vital.rb', line 65 def vital_shut(msg='',ops={}) vital('-'+msg,ops.merge({:method_name=>method_name_of_caller})) end |