* Copyright (c) 2010 the Froxlor Team (see authors). * * For the full copyright and license information, please view the COPYING * file that was distributed with this source code. You can also view the * COPYING file online at http://files.froxlor.org/misc/COPYING.txt * * @copyright (c) the authors * @author Florian Lippert <*****@*****.**> (2003-2009) * @author Froxlor team <*****@*****.**> (2010-) * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @package Install * */ $updatelog = FroxlorLogger::getInstanceOf(array('loginname' => 'updater')); $updatelogfile = validateUpdateLogFile(makeCorrectFile(dirname(__FILE__) . '/update.log')); $filelog = FileLogger::getInstanceOf(array('loginname' => 'updater')); $filelog->setLogFile($updatelogfile); // if first writing does not work we'll stop, tell the user to fix it // and then let him try again. try { $filelog->logAction(ADM_ACTION, LOG_WARNING, '-------------- START LOG --------------'); } catch (Exception $e) { standard_error('exception', $e->getMessage()); } /* * since froxlor, we have to check if there's still someone * out there using syscp and needs to upgrade */ if (!isFroxlor()) { /** * Upgrading SysCP to Froxlor-0.9
/** * logs a given text to all enabled logger-facilities * * @param int $action * @param int $type * @param string $text */ public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null) { if (self::$logtypes == null) { return; } if (self::$crondebug_flag) { switch ($type) { case LOG_INFO: $_type = 'information'; break; case LOG_NOTICE: $_type = 'notice'; break; case LOG_WARNING: $_type = 'warning'; break; case LOG_ERR: $_type = 'error'; break; case LOG_CRIT: $_type = 'critical'; break; case LOG_DEBUG: $_type = 'debug'; break; default: $_type = 'unknown'; break; } echo "[" . $_type . "] " . $text . PHP_EOL; } if (Settings::Get('logger.log_cron') == '0' && $action == CRON_ACTION) { return; } foreach (self::$logtypes as $logger) { switch ($logger) { case 'syslog': $_log = SysLogger::getInstanceOf($this->userinfo); break; case 'file': try { $_log = FileLogger::getInstanceOf($this->userinfo); } catch (Exception $e) { if ($action != CRON_ACTION) { standard_error('logerror', $e->getMessage()); } else { echo "Log-Error: " . $e->getMessage(); } } break; case 'mysql': $_log = MysqlLogger::getInstanceOf($this->userinfo); break; default: $_log = null; break; } if ($_log != null) { try { $_log->logAction($action, $type, $text); } catch (Exception $e) { if ($action != CRON_ACTION) { standard_error('logerror', $e->getMessage()); } else { echo "Log-Error: " . $e->getMessage(); } } } } }
public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null) { if (self::$logtypes == null) { return; } if ($this->settings['logger']['log_cron'] == '0' && $action == CRON_ACTION) { return; } foreach (self::$logtypes as $logger) { switch ($logger) { case 'syslog': $_log = SysLogger::getInstanceOf($this->userinfo, $this->settings); break; case 'file': try { $_log = FileLogger::getInstanceOf($this->userinfo, $this->settings); } catch (Exception $e) { if ($action != CRON_ACTION) { standard_error('logerror', $e->getMessage()); } else { echo 'Log-Error: ' . $e->getMessage(); } } break; case 'mysql': $_log = MysqlLogger::getInstanceOf($this->userinfo, $this->settings, $this->db); break; default: $_log = null; break; } if ($_log != null) { try { $_log->logAction($action, $type, $text); } catch (Exception $e) { if ($action != CRON_ACTION) { standard_error('logerror', $e->getMessage()); } else { echo 'Log-Error: ' . $e->getMessage(); } } } } }
/** * logs a given text to all enabled logger-facilities * * @param int $action * @param int $type * @param string $text */ public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null) { if (self::$logtypes == null) { return; } if (self::$crondebug_flag || $action == CRON_ACTION && $type <= LOG_WARNING) { echo "[" . getLogLevelDesc($type) . "] " . $text . PHP_EOL; } if (Settings::Get('logger.log_cron') == '0' && $action == CRON_ACTION && $type > LOG_WARNING) { return; } foreach (self::$logtypes as $logger) { switch ($logger) { case 'syslog': $_log = SysLogger::getInstanceOf($this->userinfo); break; case 'file': try { $_log = FileLogger::getInstanceOf($this->userinfo); } catch (Exception $e) { if ($action != CRON_ACTION) { standard_error('logerror', $e->getMessage()); } else { echo "Log-Error: " . $e->getMessage(); } } break; case 'mysql': $_log = MysqlLogger::getInstanceOf($this->userinfo); break; default: $_log = null; break; } if ($_log != null) { try { $_log->logAction($action, $type, $text); } catch (Exception $e) { if ($action != CRON_ACTION) { standard_error('logerror', $e->getMessage()); } else { echo "Log-Error: " . $e->getMessage(); } } } } }