<?php

namespace Sitecake\Log;

/**
 * Minimal logger that writes to PHP's error_log().
 *
 * Used during bootstrap before the FileLog (which needs a configured filesystem)
 * is available.  Replaces Monolog for SiteCake's basic needs.
 *
 * Methods match the PSR-3 interface signature so callers are compatible.
 */
class SimpleLogger
{
    public function emergency(string $message, array $context = []): void
    {
        $this->log('emergency', $message, $context);
    }

    public function alert(string $message, array $context = []): void
    {
        $this->log('alert', $message, $context);
    }

    public function critical(string $message, array $context = []): void
    {
        $this->log('critical', $message, $context);
    }

    public function error(string $message, array $context = []): void
    {
        $this->log('error', $message, $context);
    }

    public function warning(string $message, array $context = []): void
    {
        $this->log('warning', $message, $context);
    }

    public function notice(string $message, array $context = []): void
    {
        $this->log('notice', $message, $context);
    }

    public function info(string $message, array $context = []): void
    {
        $this->log('info', $message, $context);
    }

    public function debug(string $message, array $context = []): void
    {
        $this->log('debug', $message, $context);
    }

    public function log(string $level, string $message, array $context = []): void
    {
        error_log('[SITECAKE ' . strtoupper($level) . '] ' . $message);
    }
}
