Plop
A simple logging library for PHP
Plop\Handler\File Class Reference

An handler that writes log messages to a file. More...

+ Inheritance diagram for Plop\Handler\File:

Public Member Functions

 __construct ($filename, $mode= 'at', $delay=false)
 
 __destruct ()
 Free the resources used by this handler.
 
- Public Member Functions inherited from Plop\Handler\Stream
 __construct ($stream=null)
 
- Public Member Functions inherited from Plop\HandlerAbstract
 __construct (\Plop\FormatterInterface $formatter=null,\Plop\FiltersCollectionAbstract $filters=null)
 
 getFilters ()
 
 getFormatter ()
 
 handle (\Plop\RecordInterface $record)
 
 handleError (\Plop\RecordInterface $record,\Exception $exception)
 
 setFilters (\Plop\FiltersCollectionAbstract $filters)
 
 setFormatter (\Plop\FormatterInterface $formatter)
 

Protected Member Functions

 close ()
 
 emit (\Plop\RecordInterface $record)
 
 open ()
 
- Protected Member Functions inherited from Plop\Handler\Stream
 emit (\Plop\RecordInterface $record)
 
 flush ()
 
- Protected Member Functions inherited from Plop\HandlerAbstract
 emit (\Plop\RecordInterface $record)
 
 format (\Plop\RecordInterface $record)
 
 getStderr ()
 

Protected Attributes

 $baseFilename
 Path to the log file this handler writes to.
 
 $mode
 Opening mode for the log file.
 
- Protected Attributes inherited from Plop\Handler\Stream
 $stream
 The stream where log messages will be write to.
 
- Protected Attributes inherited from Plop\HandlerAbstract
 $filters
 An object handling a collection of filters.
 
 $formatter
 Formatter object to use for this handler.
 

Additional Inherited Members

- Static Protected Attributes inherited from Plop\Handler\Stream
static $stderr = null
 A stream referencing STDERR.
 

Detailed Description

An handler that writes log messages to a file.

Definition at line 28 of file File.php.

Constructor & Destructor Documentation

Plop\Handler\File::__construct (   $filename,
  $mode = 'at',
  $delay = false 
)

Construct a new instance of this handler.

Parameters
string$filenameName of the log file to write to.
string$mode(optional) Mode to use when opening the file. Defauts to "at" (append).
bool$delay(optional) Whether to delay the actual opening of the file until the first write. Defaults to false (no delay).

Definition at line 51 of file File.php.

References Plop\Handler\File\$mode, Plop\Handler\Stream\$stream, and Plop\Handler\File\open().

Member Function Documentation

Plop\Handler\File::close ( )
protected

Close the log file.

Returns
This method does not return any value.

Definition at line 99 of file File.php.

References Plop\Handler\Stream\flush().

Referenced by Plop\Handler\File\__destruct().

Plop\Handler\File::emit ( \Plop\RecordInterface  $record)
protected

Definition at line 85 of file File.php.

References Plop\Handler\File\open().

Plop\Handler\File::open ( )
protected

Open the log file.

Return values
resourceA stream representing the newly opened log file.

Definition at line 79 of file File.php.

Referenced by Plop\Handler\File\__construct(), Plop\Handler\RotatingFile\doRollover(), Plop\Handler\TimedRotatingFile\doRollover(), Plop\Handler\WatchedFile\emit(), Plop\Handler\File\emit(), and Plop\Handler\RotatingFile\shouldRollover().


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