PHP Classes

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: 18 years ago
Size: 2,316 bytes
 

Contents

Class file image Download
<html>
<head>
<style>
.error
{
    padding-left:5px;
   
    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;
    padding-left:14px;
    padding-right:14px;
    background-color: #FEEAEB;
    color: #234333;
}
</style>
</head>

<body>
<?php
////////////////////
// Override some of the settings

define('CLOG_OVERRIDE_ERROR_HANDLER',true); // will display normal errors using this class
define('CLOG_ALLOW_SENDING_EMAIL',false);
define('CLOG_SEND_EMAIL_TO',"info@somewhere.co.ok");

////////////////////
// Set our out put level for the screen to debug so that we can see all the
// levels of errors
define('CLOG_LVL_DISPLAY_LEVEL',80);

////////////////////
// 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


include("CLog.php");

////////////////////
// Testing manual debug error with static function
CLog::debug("This is how a debug error looks",__FILE__,__LINE__);
/////////////
// Should display something like
/*
DEBUG
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
/*
WARNING
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)
 
*/


?>
</body>
</html>