• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Log file PHP Class (useless but usefull for debug)

Experienced Elementalist
Joined
Nov 5, 2011
Messages
242
Reaction score
75
This is a 5 seconds code that i did for a cms that i'm making (I will release it ofc)

Anyway, here is the class, have fun!

PHP:
<?php
class Logs
{
	public function __construct()
	{

	}
	public function Error($error)
	{
	  $date = date("y")."_".date("d"); 
	  $logfile = "Logs_".$date.".txt";
	  $logs = fopen($logfile, 'a') or die("There was a fatal error: Cannot open log file.");
	  $error = date("d/i/s").": ".$error;
	  fwrite($logs, $error."\n");
	  fclose($logs);
	}
}
?>

It's easy to use, just don't forget to do
PHP:
//Init logs system
require_once("incs/logs.php");
$logs = new Logs();

Then you can use it by this way:
PHP:
 $logs->Error("Loaded skin: ".$Output['value']);

In the end, you will have a file with something like this in it..
Code:
30/32/35: Loaded skin: flyff
Have fun!
 
Back
Top