Created
October 1, 2014 19:06
-
-
Save cmourizard/3e3762bbf709ef4b05e0 to your computer and use it in GitHub Desktop.
Custom SugarCRM logger to log messages in your own log file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); | |
} | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'custom/Company/Helper/Logger.php'; | |
$myLogger = new custom_Company_Helper_Logger(); | |
$casLog->log('fatal', 'My comment logged with fatal level'); |
But thanks for the snippet! It's very useful!
Can you explain the userLogger.php and how it writes the result into company_logger.log?
$casLog->log('fatal', 'My comment logged with fatal level');
shuld be $myLogger->log('fatal', 'My comment logged with fatal level');
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
custom_Company_Helper_Logger? http://4.bp.blogspot.com/-c4o1jtkNXoM/TZyVEvHZTwI/AAAAAAAAAW4/XlD0PjNQdBM/s1600/Slithering-Camel.jpg :D