Custom SugarCRM Logger

I Saw this on a post and thought it was worth hanging on to

 

<?php

require_once 'include/SugarLogger/SugarLogger.php';

class custom_Company_Helper_Logger extends SugarLogger
{
protected $logfile = 'company_logger';
protected $ext = '.log';
protected $dateFormat = '%c';
protected $logSize = '10MB';
protected $maxLogs = 10;
protected $filesuffix = "";
protected $date_suffix = "";
protected $log_dir = './';

public function __construct()
{
$this->_doInitialization();
}
}

 

?>

 

 

To log to the new file do the following. Im sure the $casLog should be $myLogger

<?php

require_once ‘custom/Company/Helper/Logger.php’;
$myLogger = new custom_Company_Helper_Logger();
$casLog->log(‘fatal’, ‘My comment logged with fatal level’);