Class: Util::TxtLogger
Overview
Create log in a text format. This classes handling the correct way of generate the log in a .txt format.
Instance Method Summary collapse
-
#initialize(pPath = "/tmp/kuniri.log") ⇒ TxtLogger
constructor
A new instance of TxtLogger.
-
#write_log(pMessage) ⇒ Object
Write a message as .txt file.
Constructor Details
#initialize(pPath = "/tmp/kuniri.log") ⇒ TxtLogger
Returns a new instance of TxtLogger.
11 12 13 |
# File 'lib/kuniri/util/txt_logger.rb', line 11 def initialize(pPath = "/tmp/kuniri.log") super(pPath) end |
Instance Method Details
#write_log(pMessage) ⇒ Object
Write a message as .txt file.
17 18 19 20 21 22 23 |
# File 'lib/kuniri/util/txt_logger.rb', line 17 def write_log(pMessage) File.open(@log_path, 'a') do |file| file.write("="*10 + "\n") file.write("time: " + Time.now.strftime("%d/%m/%Y %H:%M:%S") + "\n") file.write("message: " + pMessage + "\n") end end |