Log file PHP Class (useless but usefull for debug)

Joined
Nov 5, 2011
Messages
241
Reaction score
86
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