Skip to content

Instantly share code, notes, and snippets.

@tristar500
Created March 18, 2012 19:47
Show Gist options
  • Save tristar500/2080351 to your computer and use it in GitHub Desktop.
Save tristar500/2080351 to your computer and use it in GitHub Desktop.
Log File Helper
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// --------------------------------------------------------------------
if ( ! function_exists('log_entry'))
{
// adds the $message to $the_log
function log_entry($the_log, $message)
{
$myPath = $_SERVER['DOCUMENT_ROOT'].'/system/logs/';
$myFile = $myPath . $the_log . '.log';
$fh = fopen($myFile, 'a');
$logData = date('m/d/Y G:i:s') . ' - ' .$message . "\r\n";
fwrite($fh,$logData);
fclose($fh);
return true;
}
}
/* End of file logs_helper.php */
/* Location: ./application/helpers/logs_helper.php */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment