nano-pro/get_logs.php
DJP 4deed84ba0 Initial commit: Nano AI Image Generator
- Complete working image generation app using Imagen 3
- PHP backend with Gemini API integration
- Dark themed UI with prompt enhancement
- Session management and logging system

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2025-12-16 08:35:02 -05:00

38 lines
856 B
PHP

<?php
session_start();
// Security check - only allow in development
if (!defined('GEMINI_API_KEY') || empty(GEMINI_API_KEY)) {
require_once 'config.php';
}
header('Content-Type: application/json');
// Get the last 50 lines from PHP error log
$errorLog = ini_get('error_log');
if (empty($errorLog)) {
$errorLog = '/tmp/php_errors.log'; // fallback
}
$logs = [];
if (file_exists($errorLog)) {
$lines = file($errorLog);
$recentLines = array_slice($lines, -50); // Last 50 lines
foreach ($recentLines as $line) {
$line = trim($line);
if (!empty($line)) {
$logs[] = $line;
}
}
} else {
$logs[] = "Error log not found at: $errorLog";
$logs[] = "Check your php.ini for error_log location";
}
echo json_encode([
'success' => true,
'logs' => $logs,
'log_file' => $errorLog
]);