Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * 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;
 }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
 /**
  * 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;
 }
Ejemplo n.º 5
0
 /**
  * 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();
     }
 }
Ejemplo n.º 6
0
 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!')");
         }
     }
 }
Ejemplo n.º 7
0
 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();
     }
 }
Ejemplo n.º 8
0
 /**
  * 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);
         }
     }
 }
Ejemplo n.º 9
0
 /**
  * Destructor.
  *
  * @api
  */
 public function __destruct()
 {
     parent::__destruct();
 }
Ejemplo n.º 10
0
 /**
  * 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;
 }
Ejemplo n.º 11
0
 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!");
             }
         }
     }
 }
Ejemplo n.º 12
0
 /**
  * Destructor.
  */
 public function __destruct()
 {
     unset($this->fao);
     unset($this->filename);
     parent::__destruct();
 }
Ejemplo n.º 13
0
 /**
  * Destructor.
  */
 public function __destruct()
 {
     unset($this->console);
     parent::__destruct();
 }
Ejemplo n.º 14
0
 public function __construct()
 {
     parent::__construct();
 }
Ejemplo n.º 15
0
 public function __construct($name, $configuration)
 {
     parent::__construct($name, $configuration);
 }
Ejemplo n.º 16
0
 /**
  * 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;
 }