PHP Classes

PHP Log and Rotate: Write messages to log files that can be rotated

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 162 All time: 8,944 This week: 488Up
Version License PHP version Categories
logger-light 1.0MIT/X Consortium ...5.2PHP 5, Files and Folders, Logging
Description 

Author

This class can write messages to log files that can be rotated.

It can write messages to log files by creating the log file from the scratch or appending the new messages to the end of the file.

If a log file exceeds a given limit the class can rotate the log files by moving the old log file to another with a new name based on the current date and time.

The class can keep up to a given limit of log files in the logs directory, so older log files are deleted when the limit of log files is reached.

Picture of Alex Lushpai
  Performance   Level  
Name: Alex Lushpai <contact>
Classes: 4 packages by
Country: Russian Federation Russian Federation
Innovation award
Innovation award
Nominee: 2x

Documentation

LoggerLight

Simple class that allows you manipulate your applications logs. It can write/rewrite log files, rotate them and send data to email. Rotation enabled by default. Can be used for keep compability with php 5.2

Example

$logger = new LoggerLight();
$logger->write('This is Log Message', '/var/www/application/logs/info.log');
$logger->rewrite(date('Y-m-d H:i:s'), '/var/www/application/logs/lastrun.log');

$logger = new LoggerLight($push = true); // enable send data via email
$logger->write('This is Alert Message', '/var/www/application/logs/error.log');

  Files folder image Files (2)  
File Role Description
Plain text file LoggerLight.php Class Independent logger class
Plain text file Readme.md Doc. Readme file

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:162
This week:0
All time:8,944
This week:488Up