/** * Clear the Log * * @return $this * @since 1.0.0 */ public function clearLog() { parent::clearLog(); $json = json_encode($this->log, JSON_BIGINT_AS_STRING | JSON_PRETTY_PRINT); file_put_contents($this->file_location, $json); return $this; }
/** * Log the message for the level given the data in context * * @param mixed $level * @param string $message * @param array $context * * @return $this * @since 1.0.0 */ public function log($level, $message, array $context = array()) { parent::log($level, $message, $context); echo '<pre>'; var_dump($this->log_entry); echo '</pre>'; return $this; }
public static function save($message, $logFile = 'static.log', $logDir = 'data/logs') { if ($logFile === null) { // Useful for just Z-Ray logging return; } $logger = AbstractLogger::generateFileLogger($logFile, $logDir); if (is_object($message) && method_exists($message, 'losLogMe')) { $message = json_encode($message->losLogMe()); } $logger->debug($message); }
/** * Log the message for the level given the data in context * * @param mixed $level * @param string $message * @param array $context * * @return $this * @since 1.0.0 * @link http://www.php.net/manual/en/function.error-log.php */ public function log($level, $message, array $context = array()) { parent::log($level, $message, $context); $output = ''; foreach ($this->columns as $column) { $output .= $this->log_entry->{$column} . "\t"; } $output .= PHP_EOL; $output = addslashes($output); if ($this->file_location === null) { error_log((string) $output); } else { error_log((string) $output, 3, $this->file_location); } return $this; }
/** * 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) { global $lng; if (parent::isEnabled()) { if (parent::getSeverity() <= 1 && $type == LOG_NOTICE) { return; } $_action = 'unknown'; switch ($action) { case USR_ACTION: $_action = $lng['admin']['customer']; break; case RES_ACTION: $_action = $lng['logger']['reseller']; break; case ADM_ACTION: $_action = $lng['logger']['admin']; break; case CRON_ACTION: $_action = $lng['logger']['cron']; break; case LOGIN_ACTION: $_action = $lng['logger']['login']; break; case LOG_ERROR: $_action = $lng['logger']['intern']; break; default: $_action = $lng['logger']['unknown']; break; } if (!isset($this->userinfo['loginname']) || $this->userinfo['loginname'] == '') { $name = 'unknown'; } else { $name = $this->userinfo['loginname']; } openlog("Froxlor", LOG_NDELAY, LOG_USER); if ($text != null && $text != '') { syslog((int) $type, "[" . ucfirst($_action) . " Action " . $name . "] " . $text); } else { syslog((int) $type, "[" . ucfirst($_action) . " Action " . $name . "] No text given!!! Check scripts!"); } closelog(); } }
public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null) { if (parent::isEnabled()) { if (parent::getSeverity() <= 1 && $type == LOG_NOTICE) { return; } if (!isset($this->userinfo['loginname']) || $this->userinfo['loginname'] == '') { $name = 'unknown'; } else { $name = " (" . $this->userinfo['loginname'] . ")"; } $now = time(); if ($text != null && $text != '') { $this->db->query("INSERT INTO `panel_syslog` (`type`, `date`, `action`, `user`, `text`)\n VALUES ('" . (int) $type . "', '" . $now . "', '" . (int) $action . "', '" . $this->db->escape($name) . "', '" . $this->db->escape($text) . "')"); } else { $this->db->query("INSERT INTO `panel_syslog` (`type`, `date`, `action`, `userid`, `text`)\n VALUES ('" . (int) $type . "', '" . $now . "', '" . (int) $action . "', '" . $this->db->escape($name) . "', 'No text given!!! Check scripts!')"); } } }
public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null) { if (parent::isEnabled()) { if (parent::getSeverity() <= 1 && $type == LOG_NOTICE) { return; } $_action = 'unknown'; switch ($action) { case USR_ACTION: $_action = 'customer'; break; case RES_ACTION: $_action = 'reseller'; break; case ADM_ACTION: $_action = 'administrator'; break; case CRON_ACTION: $_action = 'cronjob'; break; case LOG_ERROR: $_action = 'internal'; break; default: $_action = 'unknown'; break; } if (!isset($this->userinfo['loginname']) || $this->userinfo['loginname'] == '') { $name = 'unknown'; } else { $name = ' (' . $this->userinfo['loginname'] . ')'; } openlog('SysCP', LOG_NDELAY, LOG_USER); if ($text != null && $text != '') { syslog((int) $type, '[' . ucfirst($_action) . ' Action' . $name . '] ' . $text); } else { syslog((int) $type, '[' . ucfirst($_action) . ' Action' . $name . '] No text given!!! Check scripts!'); } closelog(); } }
/** * 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 (parent::isEnabled()) { if (parent::getSeverity() <= 1 && $type == LOG_NOTICE) { return; } if (!isset($this->userinfo['loginname']) || $this->userinfo['loginname'] == '') { $name = 'unknown'; } else { $name = $this->userinfo['loginname']; } $now = time(); $stmt = Database::prepare("\n\t\t\t\t\tINSERT INTO `panel_syslog` SET\n\t\t\t\t\t`type` = :type,\n\t\t\t\t\t`date` = :now,\n\t\t\t\t\t`action` = :action,\n\t\t\t\t\t`user` = :user,\n\t\t\t\t\t`text` = :text"); $ins_data = array('type' => $type, 'now' => $now, 'action' => $action, 'user' => $name); if ($text != null && $text != '') { $ins_data['text'] = $text; Database::pexecute($stmt, $ins_data); } else { $ins_data['text'] = 'No text given!!! Check scripts!'; Database::pexecute($stmt, $ins_data); } } }
/** * Destructor. * * @api */ public function __destruct() { parent::__destruct(); }
/** * Log the message for the level given the data in context * * @param mixed $level * @param string $message * @param array $context * * @return $this * @since 1.0.0 */ public function log($level, $message, array $context = array()) { parent::log($level, $message, $context); call_user_func($this->callback, $this->log_entry); return $this; }
public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null) { if (parent::isEnabled()) { if (parent::getSeverity() <= 1 && $type == LOG_NOTICE) { return; } $_action = 'unknown'; switch ($action) { case USR_ACTION: $_action = 'customer'; break; case RES_ACTION: $_action = 'reseller'; break; case ADM_ACTION: $_action = 'administrator'; break; case CRON_ACTION: $_action = 'cronjob'; break; case LOG_ERROR: $_action = 'internal'; break; default: $_action = 'unknown'; break; } $_type = 'unknown'; 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; default: $_type = 'unknown'; break; } if (!isset($this->userinfo['loginname']) || $this->userinfo['loginname'] == '') { $name = 'unknown'; } else { $name = ' (' . $this->userinfo['loginname'] . ')'; } $fp = @fopen($this->logfile, 'a'); if ($fp !== false) { $now = time(); if ($text != null && $text != '') { fwrite($fp, date('d.m.Y H:i:s', $now) . ' [' . $_type . '] [' . $_action . '-action' . $name . '] ' . $text . "\n"); } else { fwrite($fp, date('d.m.Y H:i:s', $now) . ' [' . $_type . '] [' . $_action . '-action' . $name . "] No text given!!! Check scripts!\n"); } fclose($fp); } else { if ($this->logfile != null || $this->logfile != '') { throw new Exception("Cannot open logfile '" . $this->logfile . "' for writing!"); } } } }
/** * Destructor. */ public function __destruct() { unset($this->fao); unset($this->filename); parent::__destruct(); }
/** * Destructor. */ public function __destruct() { unset($this->console); parent::__destruct(); }
public function __construct() { parent::__construct(); }
public function __construct($name, $configuration) { parent::__construct($name, $configuration); }
/** * Log the message for the level given the data in context * * @param mixed $level * @param string $message * @param array $context * * @return $this * @since 1.0.0 */ public function log($level, $message, array $context = array()) { parent::log($level, $message, $context); return $this; }