Login   Register  
PHP Classes
elePHPant
Icontem

File: logging_tester.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 1 year ago
Size: 1,019 bytes
 

Contents

Class file image Download
<?php

error_reporting
(E_ALL);
ini_set('display_errors''1');

include(
'logging.php');

$logger = new Logging();

$logger->set_location('D:\logs');

//jha-- file type could be DB, File, FileAndDB
$logger->set_type(Logging::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
$logger->set_level(Logging::Warning);

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

//jha-- file type could be Fixed or Daily
$logger->set_file_name(Logging::Daily,'logs','.txt');

//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(truetrue);