Exemple #1
0
 function write_entries($entries)
 {
     echo "<table>";
     echo "<tr><th>Time</th><th>Type</th><th>Entity</th><th>Message</th><th>Judge host</th><th>User</th><th>IP</th></tr>";
     foreach ($entries as $entry) {
         echo "<tr>";
         echo "<td>" . format_date_compact($entry->time);
         echo "<td>" . htmlspecialchars(LogLevel::toString($entry->level));
         echo "<td>" . ($entry->entity_path ? "<a href=\"index.php" . htmlspecialchars($entry->entity_path) . "\">" . $entry->entity_path . "</a>" : "-");
         echo "<td>" . nl2br(htmlspecialchars($entry->message));
         echo "<td>" . ($entry->judge_host ? htmlspecialchars($entry->judge_host) : '-');
         echo "<td>" . ($entry->userid ? htmlspecialchars(User::by_id($entry->userid, false)->name_and_login()) : '-');
         echo "<td>" . ($entry->ip ? htmlspecialchars($entry->ip) : '-');
         echo "</tr>";
     }
     echo "</table>";
 }
Exemple #2
0
 private static function log_email($loglevel, $message, $entity_path = null, $judge_host = null)
 {
     if ($loglevel >= LOG_EMAIL_LEVEL) {
         $body = "Justitia produced a log entry.\n\n";
         $body .= "Type entry: " . LogLevel::toString($loglevel) . "\n";
         $body .= "Date: " . format_date(time()) . "\n";
         if ($entity_path != null) {
             $body .= "Entity path: " . $entity_path . "\n";
         }
         if ($judge_host != null) {
             $body .= "Judge host: " . $judge_host . "\n";
         }
         if (self::userid() != null) {
             $body .= "User: "******"\n";
         }
         if (self::ip() != null) {
             $body .= "IP address: " . self::ip() . "\n";
         }
         $body .= "Message: " . $message . "\n";
         mail(LOG_EMAIL_EMAIL_ADRESSES, "Justitia logging", $body);
     }
 }