From 5c8a7923cbff95c023b3731f8236f2f5b69bd7c5 Mon Sep 17 00:00:00 2001 From: Victor Dubiniuk Date: Fri, 18 Sep 2015 20:56:07 +0300 Subject: [PATCH] Kill static logger --- lib/config.php | 6 +++++- lib/converter.php | 12 ++++++++++-- lib/helper.php | 30 ++++++++++-------------------- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/lib/config.php b/lib/config.php index 3d5848bf..6065de87 100644 --- a/lib/config.php +++ b/lib/config.php @@ -37,7 +37,11 @@ class Config { $exists = file_exists($outfile); if (!$exists){ - Helper::warnLog('Conversion test failed. Raw output:' . $result); + \OC::$server->getLogger()->warn( + 'Conversion test failed. Raw output:' . $result, + ['app' => 'documents'] + + ); return false; } else { unlink($outfile); diff --git a/lib/converter.php b/lib/converter.php index 5dbe2007..ccd3d6b3 100644 --- a/lib/converter.php +++ b/lib/converter.php @@ -22,7 +22,11 @@ class Converter { } if (empty($output)){ - Helper::warnLog('Empty conversion output'); + \OC::$server->getLogger()->warn( + 'Empty conversion output', + ['app' => 'documents'] + + ); throw new \RuntimeException('Empty conversion output'); } return $output; @@ -86,7 +90,11 @@ class Converter { curl_setopt_array($ch, $options); $content = curl_exec($ch); if (curl_errno($ch)){ - Helper::debugLog('cURL error' . curl_errno($ch) . ':' . curl_error($ch)); + \OC::$server->getLogger()->debug( + 'cURL error' . curl_errno($ch) . ':' . curl_error($ch), + ['app' => 'documents'] + + ); } curl_close($ch); diff --git a/lib/helper.php b/lib/helper.php index e6ffaee5..2f02be51 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -54,24 +54,6 @@ class Helper { return '#' . self::convertHSLToRGB($hue, 90, 60); } - /** - * @param string $message - */ - public static function debugLog($message){ - self::log($message, \OCP\Util::DEBUG); - } - - /** - * @param string $message - */ - public static function warnLog($message){ - self::log($message, \OCP\Util::WARN); - } - - public static function log($message, $level){ - \OCP\Util::writeLog(self::APP_ID, $message, $level); - } - /** * @param integer $iH * @param integer $iS @@ -178,8 +160,16 @@ class Helper { } if (empty($cmd)){ - Helper::warnLog('Pure configuration issue. Missing open office binary that is mandatory for conversion.'); - Helper::debugLog('If openoffice or libreoffice is already installed please specify the path to it using preview_libreoffice_path config. Refer to admin manual for details.'); + \OC::$server->getLogger()->warn( + 'Pure configuration issue. Missing open office binary that is mandatory for conversion.', + ['app' => 'documents'] + + ); + \OC::$server->getLogger()->debug( + 'If openoffice or libreoffice is already installed please specify the path to it using preview_libreoffice_path config. Refer to admin manual for details.', + ['app' => 'documents'] + + ); throw new \RuntimeException('Missing open office binary that is mandatory for conversion.'); }