/** * 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(); } } } } }