use new log class

Dieser Commit ist enthalten in:
o.pinke 2024-03-12 19:19:19 +01:00
Ursprung 24ba3bdb26
Commit 754c174e9d
2 geänderte Dateien mit 21 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -19,6 +19,10 @@
* *
* $Id$ * $Id$
*/ */
use ConLite\Log\LogWriter;
use ConLite\Log\Log;
if (!defined('CON_FRAMEWORK')) { if (!defined('CON_FRAMEWORK')) {
die('Illegal call'); die('Illegal call');
} }
@ -148,9 +152,9 @@ class cApiModule extends Item {
try { try {
mkdir($this->_aModFileEditConf['modPath'], 0777, true); mkdir($this->_aModFileEditConf['modPath'], 0777, true);
} catch (Exception $ex) { } catch (Exception $ex) {
$oWriter = cLogWriter::factory("File", ['destination' => $sPathErrorLog]); $writer = LogWriter::factory("File", ['destination' => $sPathErrorLog]);
$oLog = new cLog($oWriter); $log = new Log($writer);
$oLog->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), cLog::WARN); $log->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), Log::WARN);
} }
} }
@ -160,9 +164,9 @@ class cApiModule extends Item {
try { try {
mkdir($this->getModulePath(), 0777); mkdir($this->getModulePath(), 0777);
} catch (Exception $ex) { } catch (Exception $ex) {
$oWriter = cLogWriter::factory("File", ['destination' => $sPathErrorLog]); $writer = LogWriter::factory("File", ['destination' => $sPathErrorLog]);
$oLog = new cLog($oWriter); $log = new Log($writer);
$oLog->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), cLog::WARN); $log->log($ex->getFile() . " (" . $ex->getLine() . "): " . $ex->getMessage(), Log::WARN);
} }
if (is_writable($this->getModulePath())) { if (is_writable($this->getModulePath())) {
@ -171,9 +175,9 @@ class cApiModule extends Item {
umask($this->_oldumask); umask($this->_oldumask);
} }
} else { } else {
$oWriter = cLogWriter::factory("File", ['destination' => $sPathErrorLog]); $writer = LogWriter::factory("File", ['destination' => $sPathErrorLog]);
$oLog = new cLog($oWriter); $log = new Log($writer);
$oLog->log(__FILE__ . " (" . __LINE__ . "): " . 'Error: Cannot create mod path '.$this->getModulePath(), cLog::WARN); $log->log(__FILE__ . " (" . __LINE__ . "): " . 'Error: Cannot create mod path '.$this->getModulePath(), Log::WARN);
} }
return FALSE; return FALSE;
} }
@ -244,7 +248,8 @@ class cApiModule extends Item {
* *
* @return array Found strings for this module * @return array Found strings for this module
*/ */
public function parseModuleForStrings() { public function parseModuleForStrings(): bool|array
{
global $cfg; global $cfg;
if ($this->virgin == true) { if ($this->virgin == true) {
return false; return false;

Datei anzeigen

@ -1,4 +1,8 @@
<?php <?php
use ConLite\Log\LogWriter;
use ConLite\Log\Log;
if(!defined('CON_FRAMEWORK')) { if(!defined('CON_FRAMEWORK')) {
die('Illegal call'); die('Illegal call');
} }
@ -12,11 +16,11 @@ class pimExeption extends Exception {
parent::__construct($message, $code, $previous); parent::__construct($message, $code, $previous);
// create a logger class and save it for all logging purposes // create a logger class and save it for all logging purposes
$writer = cLogWriter::factory("File", array( $writer = LogWriter::factory("File", array(
'destination' => cRegistry::getConfigValue('path', 'data') 'destination' => cRegistry::getConfigValue('path', 'data')
. 'logs/exception.log' . 'logs/exception.log'
)); ));
$this->_logger = new cLog($writer); $this->_logger = new Log($writer);
// determine if exception should be logged // determine if exception should be logged
if (false === $this->_log_exception if (false === $this->_log_exception