PHP Classes

File: logging_tester.php

Recommend this page to a friend!
  Classes of Junai Hassan  >  PHP Log File Database  >  logging_tester.php  >  Download  
File: logging_tester.php
Role: Example script
Content type: text/plain
Description: Example script to test logging class
Class: PHP Log File Database
Log messages to files or to a MySQL database
Author: By
Last change:
Date: 2 years ago
Size: 1,019 bytes


Class file image Download

ini_set('display_errors', '1');


$logger = new Logging();


//jha-- file type could be DB, File, FileAndDB

//jha-- set 3 to log all only warning and errors
//jha-- remember logs added with level higher than this level will be logged only

//jha-- set dtabase credentails
$logger->set_db_credentails('localhost','root', '', 'test_db');

//jha-- file type could be Fixed or Daily

//jha-- this will be written
$logger->write('This is Error', Logging::Error);

//jha-- this will be written
$logger->write('This is Warning', Logging::Warning);

//jha-- this will not be written
$logger->write('This is Warning', Logging::Debug);

//jha-- this will not be written
$logger->write('This is Warning', Logging::Info);

//jha-- flush logs
$logger->flush(true, true);