19 lines
No EOL
610 B
PHP
19 lines
No EOL
610 B
PHP
<?php
|
|
require_once("Settings.php");
|
|
|
|
$limit = 100;
|
|
if (isset($argv[1]) && is_numeric($argv[1])) {
|
|
$limit = $argv[1];
|
|
}
|
|
|
|
$db = new Database();
|
|
$stmt = $db::$handle->prepare("SELECT * FROM (SELECT * FROM `logs` ORDER BY datetime(`created`) DESC, `id` DESC LIMIT " . $limit . ") ORDER BY `created` ASC, `id` ASC");
|
|
$result = $stmt->execute();
|
|
|
|
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
|
$levelColor = Logger::getColor($row["level"]);
|
|
|
|
echo "\033[0;37m[" . $row["created"] . "] " . $levelColor . $row["level"] . "\033[0;37m: " . $row["message"] . "\033[0m" . PHP_EOL;
|
|
}
|
|
|
|
$db->close(); |