Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

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