My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads

This class allow programmers to easily write messages to a log file.

DOWNLOAD LATEST VERSION

Download MyLogPHP-1.2.1.class.php

CHANGELOG

1.2.1
  • Disable a warning message if an internal variable is not set.
1.2
  • Two columns added in CSV output: LINE and FILE.
1.1
  • Added support to choose the field separator. Comma is still the default.

Want more features? I AM LISTENING!

mylogphp.uservoice.com (no login required)

EXAMPLES

$log = new MyLogPHP();

$log->info('The program starts here.');

$log->warning('This problem can affect the program logic');

$log->warning('Use this software at your own risk!');

$log->info('Lawrence Lagerlof','AUTHOR');

$log->info('Asimov rulez','FACT');

$log->error('Everything crash and burn','IE');

$log->debug("select * from table",'DB');

QUICK START

Include in your script the file "MyLogPHP.class.php".

include('MyLogPHP.class.php');

Instantiate the object. Optionally you can pass the log file name and the separator as a parameter. Default log file name is "_MyLogPHP-1.2.log.csv" in current folder, and default separator is comma (,).

$log = new MyLogPHP('./log/debug.log.csv');

Make sure the directory where the log will be created is writable.

Call method "info", "warning", "error" or "debug" to write the messages. The first parameter is the message, the optional second parameter is a free tag at your choice to help you filter the log when opened by an spreadsheet software, like OpenOffice Calc or Microsoft Excel.

$log->info('This message will be logged in the file debug.log.csv','TIP');

That's it!

Powered by Google Project Hosting