mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
New: dol_syslog method accept a suffix to use different log files for
log.
This commit is contained in:
parent
fd6b51413c
commit
7bbbda2dce
|
|
@ -31,7 +31,8 @@ For developers:
|
|||
- Function plimit of databases drivers accept -1 as value (it means default value set
|
||||
into conf->liste_limit).
|
||||
- New: Add option dol_hide_topmenu and dol_hide_leftmenu onto login page.
|
||||
|
||||
- New: dol_syslog method accept a suffix to use different log files for log.
|
||||
|
||||
For translators:
|
||||
- Update language files.
|
||||
|
||||
|
|
|
|||
|
|
@ -485,15 +485,16 @@ function dol_strtoupper($utf8_string)
|
|||
* This function works only if syslog module is enabled.
|
||||
* This must not use any call to other function calling dol_syslog (avoid infinite loop).
|
||||
*
|
||||
* @param string $message Line to log. Ne doit pas etre traduit si level = LOG_ERR
|
||||
* @param int $level Log level
|
||||
* 0=Show nothing
|
||||
* On Windows LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=6, LOG_DEBUG=6 si define_syslog_variables ou PHP 5.3+, 7 si dolibarr
|
||||
* On Linux LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
|
||||
* @param int $ident 1=Increase ident of 1, -1=Decrease ident of 1
|
||||
* @param string $message Line to log. Ne doit pas etre traduit si level = LOG_ERR
|
||||
* @param int $level Log level
|
||||
* 0=Show nothing
|
||||
* On Windows LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=6, LOG_DEBUG=6 si define_syslog_variables ou PHP 5.3+, 7 si dolibarr
|
||||
* On Linux LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
|
||||
* @param int $ident 1=Increase ident of 1, -1=Decrease ident of 1
|
||||
* @param string $suffixinfilename When output is a file, append this suffix into default log filename.
|
||||
* @return void
|
||||
*/
|
||||
function dol_syslog($message, $level = LOG_INFO, $ident = 0)
|
||||
function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='')
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
|
|
@ -543,7 +544,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0)
|
|||
// Loop on each log handler and send output
|
||||
foreach ($conf->loghandlers as $loghandlerinstance)
|
||||
{
|
||||
$loghandlerinstance->export($data);
|
||||
$loghandlerinstance->export($data,$suffixinfilename);
|
||||
}
|
||||
unset($data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,22 +96,25 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
|
|||
/**
|
||||
* Return the parsed logfile path
|
||||
*
|
||||
* @return string
|
||||
* @param string $suffixinfilename When output is a file, append this suffix into default log filename.
|
||||
* @return string
|
||||
*/
|
||||
private function getFilename()
|
||||
private function getFilename($suffixinfilename='')
|
||||
{
|
||||
return str_replace('DOL_DATA_ROOT', DOL_DATA_ROOT, SYSLOG_FILE);
|
||||
$tmp=str_replace('DOL_DATA_ROOT', DOL_DATA_ROOT, SYSLOG_FILE);
|
||||
return $suffixinfilename?preg_replace('/\.log$/i', $suffixinfilename.'.log', $tmp):$tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export the message
|
||||
*
|
||||
* @param array $content Array containing the info about the message
|
||||
* @param array $content Array containing the info about the message
|
||||
* @param string $suffixinfilename When output is a file, append this suffix into default log filename.
|
||||
* @return void
|
||||
*/
|
||||
public function export($content)
|
||||
public function export($content, $suffixinfilename='')
|
||||
{
|
||||
$logfile = $this->getFilename();
|
||||
$logfile = $this->getFilename($suffixinfilename);
|
||||
|
||||
if (defined("SYSLOG_FILE_NO_ERROR")) $filefd = @fopen($logfile, 'a+');
|
||||
else $filefd = fopen($logfile, 'a+');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user