File: example.php

Recommend this page to a friend!
  Classes of Rolf  >  CLog Class  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example script
Class: CLog Class
Log errors to the page, file or e-mail
Author: By
Last change:
Date: 14 years ago
Size: 2,316 bytes


Class file image Download
    font-size: 12px;
    font-family: Verdana,Arial, Geneva, sans-serif;
    color: white;
    height: 20px;
    line-height: 20px;
    width: 100%;
    background-color: #D0020A;
    filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,gridsize=100,startColorstr='#D0020A', endColorstr='#FF4E56');
    border: 1px solid gray;
    font-weight: bold;
.error div
    font-weight: normal;
    font-size: 10px;
    border-top: 1px dotted gray;
    background-color: #FEEAEB;
    color: #234333;

// Override some of the settings

define('CLOG_OVERRIDE_ERROR_HANDLER',true); // will display normal errors using this class

// Set our out put level for the screen to debug so that we can see all the
// levels of errors

// We are going to allow all out errors to be logged
define('CLOG_LOG_FILE_PATH',".\\"); // Path where the errors are logged
define('CLOG_LVL_WRITE_TO_FILE',80); // level of the logging


// Testing manual debug error with static function
CLog::debug("This is how a debug error looks",__FILE__,__LINE__);
// Should display something like
This is how a debug error looks
File: D:\www\splicer\phpClasses\example.php (#50)

// Testing overide of default errors
$x = 233 / 0;
// Should display something like
Division by zero
File: D:\www\splicer\phpClasses\example.php (#63)

At the end of this we should have error logs that looks as follows
debug.log (defined by CLOG_LOG_FILE_DEBUG)
2006-06-30 03:27:23 : *** DEBUG This is how a debug error looks (F-D:\www\splicer\phpClasses\example.php) (#-56)

error.log (defined by CLOG_LOG_FILE_ERROR)
2006-06-30 03:27:23 : *** WARNING Division by zero (F-D:\www\splicer\phpClasses\example.php) (#-69)


For more information send a message to info at phpclasses dot org.