PHP Classes
elePHPant
Icontem

Simple class for logs: Log entries to files

Recommend this page to a friend!
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2011-03-01 (5 years ago) RSS 2.0 feedNot yet rated by the usersTotal: 387 All time: 6,317 This week: 953Up
Version License PHP version Categories
simple-class-for-log 1.0GNU General Publi...5.0PHP 5, Logging
Description Author

This class can log entries to files.

It can append log entry messages to given log files.

The log entries can include the current timestamp and the current script memory usage.

Picture of Stanislav Afanasiev
  Performance   Level  
Name: Stanislav Afanasiev <contact>
Classes: 2 packages by
Country: Russian Federation Russian Federation
Innovation award
Innovation award
Nominee: 1x

Details
/**
 * Simple class for logs
 * @description: Example use
 */

 // include class
 require_once 'Logger.class.php';
 
 
 // create object of logger class
 
 // write in log.txt
 // log file be overwritten
 $obLog = new Logger('log.txt');
 // or
 // log file be NOT overwritten
 $obLog = new Logger('log.txt','r+');
 
 // log write
 // simple use
 // log write be date and memory use by default ( separator \n)
 $obLog->LogIt('Start script');
 
 // without memory use
 $obLog->LogIt('Start script',true,"\n","a+",false);
 
 // with r+ mode
  $obLog->LogIt('Start script',true,"\n","r+");
  
  // write in html file
  $obLog = new Logger('log.html');
  $obLog->LogIt('Start script',true,"<br>");
  Files folder image Files  
File Role Description
Accessible without login Plain text file Example.php Example Example use
Plain text file Logger.class.php Class Logger class
Accessible without login Plain text file README Doc. README

 Version Control Unique User Downloads Download Rankings  
 0%
Total:387
This week:0
All time:6,317
This week:953Up