get('system', 'logfile'); if (!@file_exists($logfile) || !@is_writable($logfile)) { throw new LoggerArgumentException(sprintf('%s is not a valid logfile', $logfile)); } $loglevel = static::mapLegacyConfigDebugLevel($config->get('system', 'loglevel')); if (array_key_exists($loglevel, StreamLoggerClass::levelToInt)) { $loglevel = StreamLoggerClass::levelToInt[$loglevel]; } else { throw new LogLevelException(sprintf('The level "%s" is not valid.', $loglevel)); } $stream = $fileSystem->createStream($logfile); return new StreamLoggerClass($channel ?? $this->channel, $this->introspection, $stream, $loglevel, getmypid()); } /** * Creates a new PSR-3 compliant develop logger * * If you want to debug only interactions from your IP or the IP of a remote server for federation debug, * you'll use this logger instance for the duration of your work. * * It should never get filled during normal usage of Friendica * * @return LoggerInterface The PSR-3 compliant logger instance * * @throws LoggerException */ public function createDev(IManageConfigValues $config) { $debugging = $config->get('system', 'debugging'); $logfile = $config->get('system', 'dlogfile'); $developerIp = $config->get('system', 'dlogip'); if ((!isset($developerIp) || !$debugging) && (!is_file($logfile) || is_writable($logfile))) { return new NullLogger(); } return $this->create($config, $logfile, LogChannel::DEV); } }