/ Published in: PHP
                    
                                        
To keep up on important incidents on your site without having to dig through server logs the alternative can be custom logs.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
<?php
// first we declare a class to handle the file operations.
class logfile{
function write($logString )
{
// this can be parameratized
{
$logString .="\n"; // insures each entry is on a new line
return( true );
}
else
{
return( false );
}
}
} // end logfile class
function logAction($job,$cd,$msg)
{
// now we can create the custom code using the class
//invalid must always be the last entry ... add more if needed
// If the code is invalid return INVALID as the message type
// customize the date format to fit your requiremments
$theLog = new logfile();
// an instance of the logfile class
$msgStr=$msgTypes[$cod].'{'.$cd.'}: '.$job.': '.$dt.'>>> '.$msg;
// create the log message
$theLog->write($msgStr); // this fires the file handling in the class
}
?>
URL: http://coboldinosaur.com/pages/Custom_Logging_Site_Events.html
Comments
 Subscribe to comments
                    Subscribe to comments
                
                