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

An handler that logs to a file and automatically reopens that file when it changes (eg. due to log rotation). More...

+ Inheritance diagram for Plop\Handler\WatchedFile:

Public Member Functions

 __construct ($filename, $mode= 'at', $delay=false)
 
- Public Member Functions inherited from Plop\Handler\File
 __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

 emit (\Plop\RecordInterface $record)
 
- Protected Member Functions inherited from Plop\Handler\File
 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

 $dev
 Device the watched file resides on.
 
 $ino
 Inode number of the watched file.
 
- Protected Attributes inherited from Plop\Handler\File
 $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 logs to a file and automatically reopens that file when it changes (eg. due to log rotation).

Definition at line 29 of file WatchedFile.php.

Constructor & Destructor Documentation

Plop\Handler\WatchedFile::__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 38 of file WatchedFile.php.

References Plop\Handler\File\$mode.

Member Function Documentation

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

Definition at line 54 of file WatchedFile.php.

References Plop\Handler\WatchedFile\$dev, and Plop\Handler\File\open().


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