summaryrefslogtreecommitdiffstats
path: root/lib/private/Log
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Log')
-rw-r--r--lib/private/Log/ErrorHandler.php5
-rw-r--r--lib/private/Log/File.php2
-rw-r--r--lib/private/Log/LogDetails.php10
-rw-r--r--lib/private/Log/LogFactory.php2
-rw-r--r--lib/private/Log/PsrLoggerAdapter.php1
-rw-r--r--lib/private/Log/Rotate.php2
-rw-r--r--lib/private/Log/Systemdlog.php3
7 files changed, 10 insertions, 15 deletions
diff --git a/lib/private/Log/ErrorHandler.php b/lib/private/Log/ErrorHandler.php
index 2d2cf7abd67..d37af8212a0 100644
--- a/lib/private/Log/ErrorHandler.php
+++ b/lib/private/Log/ErrorHandler.php
@@ -63,7 +63,7 @@ class ErrorHandler {
//Fatal errors handler
public static function onShutdown() {
$error = error_get_last();
- if($error && self::$logger) {
+ if ($error && self::$logger) {
//ob_end_clean();
$msg = $error['message'] . ' at ' . $error['file'] . '#' . $error['line'];
self::$logger->critical(self::removePassword($msg), ['app' => 'PHP']);
@@ -89,14 +89,11 @@ class ErrorHandler {
}
$msg = $message . ' at ' . $file . '#' . $line;
self::$logger->error(self::removePassword($msg), ['app' => 'PHP']);
-
}
//Recoverable handler which catch all errors, warnings and notices
public static function onAll($number, $message, $file, $line) {
$msg = $message . ' at ' . $file . '#' . $line;
self::$logger->debug(self::removePassword($msg), ['app' => 'PHP']);
-
}
-
}
diff --git a/lib/private/Log/File.php b/lib/private/Log/File.php
index 57b4e9353ef..6be200f6d3e 100644
--- a/lib/private/Log/File.php
+++ b/lib/private/Log/File.php
@@ -59,7 +59,7 @@ class File extends LogDetails implements IWriter, IFileBased {
parent::__construct($config);
$this->logFile = $path;
if (!file_exists($this->logFile)) {
- if(
+ if (
(
!is_writable(dirname($this->logFile))
|| !touch($this->logFile)
diff --git a/lib/private/Log/LogDetails.php b/lib/private/Log/LogDetails.php
index 5ed486195cf..dcaa5919d73 100644
--- a/lib/private/Log/LogDetails.php
+++ b/lib/private/Log/LogDetails.php
@@ -58,7 +58,7 @@ abstract class LogDetails {
$time = $time->format($format);
$url = ($request->getRequestUri() !== '') ? $request->getRequestUri() : '--';
$method = is_string($request->getMethod()) ? $request->getMethod() : '--';
- if($this->config->getValue('installed', false)) {
+ if ($this->config->getValue('installed', false)) {
$user = \OC_User::getUser() ? \OC_User::getUser() : '--';
} else {
$user = '--';
@@ -82,7 +82,7 @@ abstract class LogDetails {
'version'
);
- if(is_array($message) && !array_key_exists('Exception', $message)) {
+ if (is_array($message) && !array_key_exists('Exception', $message)) {
// Exception messages should stay as they are,
// anything else modern is split to 'message' (string) and
// data (array) fields
@@ -99,10 +99,10 @@ abstract class LogDetails {
// PHP's json_encode only accept proper UTF-8 strings, loop over all
// elements to ensure that they are properly UTF-8 compliant or convert
// them manually.
- foreach($entry as $key => $value) {
- if(is_string($value)) {
+ foreach ($entry as $key => $value) {
+ if (is_string($value)) {
$testEncode = json_encode($value, JSON_UNESCAPED_SLASHES);
- if($testEncode === false) {
+ if ($testEncode === false) {
$entry[$key] = utf8_encode($value);
}
}
diff --git a/lib/private/Log/LogFactory.php b/lib/private/Log/LogFactory.php
index 901ff382d8b..9a55b155f39 100644
--- a/lib/private/Log/LogFactory.php
+++ b/lib/private/Log/LogFactory.php
@@ -71,7 +71,7 @@ class LogFactory implements ILogFactory {
protected function buildLogFile(string $logFile = ''):File {
$defaultLogFile = $this->systemConfig->getValue('datadirectory', \OC::$SERVERROOT.'/data').'/nextcloud.log';
- if($logFile === '') {
+ if ($logFile === '') {
$logFile = $this->systemConfig->getValue('logfile', $defaultLogFile);
}
$fallback = $defaultLogFile !== $logFile ? $defaultLogFile : '';
diff --git a/lib/private/Log/PsrLoggerAdapter.php b/lib/private/Log/PsrLoggerAdapter.php
index 4bfd9a2a246..bdaeda9f129 100644
--- a/lib/private/Log/PsrLoggerAdapter.php
+++ b/lib/private/Log/PsrLoggerAdapter.php
@@ -162,5 +162,4 @@ final class PsrLoggerAdapter implements LoggerInterface {
}
$this->logger->log($level, $message, $context);
}
-
}
diff --git a/lib/private/Log/Rotate.php b/lib/private/Log/Rotate.php
index a5fc7d5a0cd..8cafc6e639c 100644
--- a/lib/private/Log/Rotate.php
+++ b/lib/private/Log/Rotate.php
@@ -41,7 +41,7 @@ class Rotate extends \OC\BackgroundJob\Job {
$this->filePath = $systemConfig->getValue('logfile', $systemConfig->getValue('datadirectory', \OC::$SERVERROOT . '/data') . '/nextcloud.log');
$this->maxSize = \OC::$server->getConfig()->getSystemValue('log_rotate_size', 100 * 1024 * 1024);
- if($this->shouldRotateBySize()) {
+ if ($this->shouldRotateBySize()) {
$rotatedFile = $this->rotate();
$msg = 'Log file "'.$this->filePath.'" was over '.$this->maxSize.' bytes, moved to "'.$rotatedFile.'"';
\OC::$server->getLogger()->warning($msg, ['app' => Rotate::class]);
diff --git a/lib/private/Log/Systemdlog.php b/lib/private/Log/Systemdlog.php
index e74cab40fd6..692af7d8ecf 100644
--- a/lib/private/Log/Systemdlog.php
+++ b/lib/private/Log/Systemdlog.php
@@ -58,11 +58,10 @@ class Systemdlog extends LogDetails implements IWriter {
public function __construct(SystemConfig $config) {
parent::__construct($config);
- if(!function_exists('sd_journal_send')) {
+ if (!function_exists('sd_journal_send')) {
throw new HintException(
'PHP extension php-systemd is not available.',
'Please install and enable PHP extension systemd if you wish to log to the Systemd journal.');
-
}
$this->syslogId = $config->getValue('syslog_tag', 'Nextcloud');
}