Log::NullLogLite(3pm)

Log::NullLogLite3pm

The "log::nullloglite" class implements the null object pattern for the "log::loglite" class.

Usage

  use Log::NullLogLite;
               
  # create new Log::NullLogLite object
  my $log = new Log::NullLogLite();
  ...
  # we had an error (this entry will not be written to the log 
  # file because we use Log::NullLogLite object).
  $log->write("Could not open the file ".$file_name.": $!", 4);

Overview

The "Log::NullLogLite" class is derived from the "Log::LogLite" class and implement the Null Object Pattern to let us to use the "Log::LogLite" class with null "Log::LogLite" objects. We might want to do that if we use a "Log::LogLite" object in our code, and we do not want always to actually define a "Log::LogLite" object (i.e. not always we want to write to a log file). In such a case we will create a "Log::NullLogLite" object instead of the "Log::LogLite" object, and will use that object instead. The object has all the methods that the "Log::LogLite" object has, but those methods do nothing. Thus our code will continue to run without any change, yet we will not have to define a log file path for the "Log::LogLite" object, and no log will be created.

Constructor

new ( FILEPATH [,LEVEL [,DEFAULT_MESSAGE ]] )

The constructor. The parameters will not have any affect. Returns the new Log::NullLogLite object.

Methods

write( MESSAGE [, LEVEL ] )

Does nothing. The parameters will not have any affect. Returns nothing.

level( [ LEVEL ] )

Does nothing. The parameters will not have any affect. Returns -1.

default_message( [ MESSAGE ] )

Does nothing. The parameters will not have any affect. Returns empty string ("").

Releases

12 releases since Debian 3.0 (Woody); the text changed 7 times.

  1. 3.0
  2. 3.1
  3. 4.0
  4. 5.0
  5. 6.0–9
  6. 10
  7. 11
  8. 12–13

Author

Rani Pinchuk, [email protected]

From liblog-loglite-perl 0.82-9 in Debian 13 (Trixie). Parsed by carta from the page's man source.