Cradle  0.3.3
Simple library for creating Web-based applications
Logger Class Reference
Inheritance diagram for Logger:
Debug

Public Member Functions

 __construct ($destination=null)
 
 init ($destination=1)
 
 save ($message)
 
 getMessages ()
 
 getLastMessage ()
 

Protected Attributes

 $destination
 
 $buffer = []
 

Detailed Description

This class is designed to save log messages.

Version
1.0
Author
Digger mrdig.nosp@m.ger@.nosp@m.sad-s.nosp@m.yste.nosp@m.ms.ru

Example of usage:

$logger = new Logger("file.log");
$logger->save("New message 1");
$logger->save("New message 2");
print_r($logger->getMessages());

Constructor & Destructor Documentation

__construct (   $destination = null)

Constructor

Parameters
int | string$destination
See also
init

Member Function Documentation

getLastMessage ( )

Returns data of the last message

Returns
mixed The message of any type.
getMessages ( )

Returns an array of log messages.

Returns
array An array of bufferd messages.
init (   $destination = 1)

Init the class

Parameters
int | string$destinationDefines a log destination
Possible values:
false - no log;
1 - log to buffer;
2 - log to STDIN;
filename - log to file;
save (   $message)

Save a message

Parameters
mixed$messageThe log message of any type.

Field Documentation

$buffer = []
protected

array The default buffer to save messages

$destination
protected

mixed Defines a log destination.

See also
init

The documentation for this class was generated from the following file: