Class: Util::Logger

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

Overview

Abstract class responsible for define the log strategy.

Direct Known Subclasses

HtmlLogger, TxtLogger

Instance Method Summary collapse

Constructor Details

#initialize(pPath = "/tmp/kuniri.log") ⇒ Logger

Create/open the log file, and save the path.

Parameters:

  • pPath (String) (defaults to: "/tmp/kuniri.log")

    Receives the path for save the log file. By default it is saved on /tmp with the name "kuniri".



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

def initialize(pPath = "/tmp/kuniri.log")
  File.open(pPath, 'a')
  @log_path = pPath
end

Instance Method Details

#write_log(pMessage) ⇒ Object

Write log, based on the message and the path. The most important thing about this method, is related with the implementation in different formats. Ex.: write_log can be implemented as HTML, txt, XML, etc.

Parameters:

  • pMessage

    to write in the log file.

Raises:

  • (NotImplementedError)


22
23
24
# File 'lib/kuniri/util/logger.rb', line 22

def write_log(pMessage)
  raise NotImplementedError
end