6require_once DOL_DOCUMENT_ROOT.
'/core/modules/syslog/logHandler.php';
13 public $code =
'syslog';
44 return $langs->trans(
'OnlyWindowsLOG_USER');
55 if (!function_exists(
'openlog')) {
73 'constant' =>
'SYSLOG_FACILITY',
74 'name' => $langs->trans(
'SyslogFacility'),
75 'default' =>
'LOG_USER'
93 if (!empty($_SERVER[
"WINDIR"])) {
94 $facility = constant(
'LOG_USER');
97 dol_syslog(
"admin/syslog: facility ".$facility);
100 $this->errors[] = $langs->trans(
"ErrorUnknownSyslogConstant",
getDolGlobalString(
'SYSLOG_FACILITY'));
112 public function export($content, $suffixinfilename =
'')
121 $facility = constant(
$conf->global->SYSLOG_FACILITY);
123 $facility = constant(
'LOG_USER');
127 openlog(
'dolibarr', LOG_PID | LOG_PERROR, (
int) $facility);
129 $message = sprintf(
"%6s",
dol_trunc($content[
'osuser'], 6,
'right',
'UTF-8', 1));
130 $message .=
" ".$content[
'message'];
132 syslog($content[
'level'], $message);
Parent class for log handlers.
Class to manage logging to syslog.
export($content, $suffixinfilename='')
Export the message.
configure()
Return array of configuration data.
isActive()
Is the logger active ?
getVersion()
Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development')
checkConfiguration()
Return if configuration is valid.
getInfo()
Content of the info tooltip.
getName()
Return name of logger.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...