Class: Util::HtmlLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/kuniri/util/html_logger.rb

Overview

Handling HTML log.

Instance Method Summary collapse

Constructor Details

#initialize(pPath = "/tmp/kuniri_log.html") ⇒ HtmlLogger

Returns a new instance of HtmlLogger.

Parameters:

  • pPath (String) (defaults to: "/tmp/kuniri_log.html")

    Receives the path to save the log.



11
12
13
14
# File 'lib/kuniri/util/html_logger.rb', line 11

def initialize(pPath = "/tmp/kuniri_log.html")
  super(pPath)
  initialize_html_file
end

Instance Method Details

#write_log(pMessage) ⇒ Object

documentation.

Parameters:

  • pMessage (String)

    Log message to be write as .html



18
19
20
21
22
23
24
# File 'lib/kuniri/util/html_logger.rb', line 18

def write_log(pMessage)
  File.open(@log_path, 'a') do |file|
    file.write("<hr>\n")
    file.write("<p>" + Time.now.strftime("%d/%m/%Y %H:%M:%S") + "</p>\n")
    file.write("\t<i>#{pMessage}</i>\n")
  end
end