Enhance syslog logging
This commit is contained in:
parent
36329f9e7e
commit
2413627de9
4 changed files with 18 additions and 2 deletions
|
@ -119,7 +119,7 @@ class Logger
|
|||
|
||||
case 'syslog':
|
||||
try {
|
||||
$logger = new SyslogLogger($this->channel, $introspection, $loglevel);
|
||||
$logger = new SyslogLogger($this->channel, $introspection, $loglevel, $config->get('system', 'syslog_flags', SyslogLogger::DEFAULT_FLAGS), $config->get('system', 'syslog_facility', SyslogLogger::DEFAULT_FACILITY));
|
||||
} catch (LogLevelException $exception) {
|
||||
// If there's a wrong config value for loglevel, try again with standard
|
||||
$logger = $this->create($database, $config, $profiler, $fileSystem, LogLevel::NOTICE);
|
||||
|
|
|
@ -34,6 +34,11 @@ class SyslogLogger extends AbstractLogger
|
|||
{
|
||||
const IDENT = 'Friendica';
|
||||
|
||||
/** @var int The default syslog flags */
|
||||
const DEFAULT_FLAGS = LOG_PID | LOG_ODELAY | LOG_CONS;
|
||||
/** @var int The default syslog facility */
|
||||
const DEFAULT_FACILITY = LOG_USER;
|
||||
|
||||
/**
|
||||
* Translates LogLevel log levels to syslog log priorities.
|
||||
* @var array
|
||||
|
@ -101,7 +106,7 @@ class SyslogLogger extends AbstractLogger
|
|||
* @throws LogLevelException
|
||||
* @throws LoggerException
|
||||
*/
|
||||
public function __construct($channel, Introspection $introspection, string $level = LogLevel::NOTICE, int $logOpts = LOG_PID, int $logFacility = LOG_USER)
|
||||
public function __construct($channel, Introspection $introspection, string $level = LogLevel::NOTICE, int $logOpts = self::DEFAULT_FLAGS, int $logFacility = self::DEFAULT_FLAGS)
|
||||
{
|
||||
parent::__construct($channel, $introspection);
|
||||
$this->logOpts = $logOpts;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue