<?php
// Simple fast logger (non-blocking best-effort)
class Logger {
    private static $file;
    public static function init($path) {
        self::$file = $path;
    }
    public static function log($tag, $msg, $context = []) {
        if (!self::$file) {
            self::$file = __DIR__ . '/app.log';
        }
        $line = date('Y-m-d H:i:s') . " | $tag | " . $msg;
        if ($context) {
            $line .= ' | ' . json_encode($context);
        }
        $line .= "\n";
        @file_put_contents(self::$file, $line, FILE_APPEND);
    }
}
