Skip to content

Instantly share code, notes, and snippets.

@gnuget
Created October 3, 2009 05:20
Show Gist options
  • Save gnuget/200418 to your computer and use it in GitHub Desktop.
Save gnuget/200418 to your computer and use it in GitHub Desktop.
<?php
/**
* Magic Fields's debug Class
*
* @package Magic Fields
* @subpackage tools
*/
class Debug{
/**
*
* Writes logging info to a file.
*
* @var $string message
*/
function log($msg,$path = "") {
if(empty($path)){
$path = dirname(__FILE__)."/../tmp/debug/";
}
if(!is_string($msg)){
$msg = print_r($msg,true);
}
$fp = fopen($path.'magic_fields.log', 'a+');
$date = gmdate( 'Y-m-d H:i:s' );
fwrite($fp, "$date - $msg\n");
fclose($fp);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment