<?php
defined('ABSPATH')||exit;
final class Fortis_WP_Log
{
    private const OPTION='fortisrestore_activity_log';
    public static function write(string$operation,string$status,string$message,array$context=[]):void{$entries=get_option(self::OPTION,[]);array_unshift($entries,['time'=>gmdate(DATE_ATOM),'operation'=>sanitize_key($operation),'status'=>$status==='success'?'success':'failed','message'=>sanitize_text_field($message),'context'=>$context]);update_option(self::OPTION,array_slice($entries,0,200),false);}
    public static function recent(int$limit=100):array{return array_slice((array)get_option(self::OPTION,[]),0,max(1,$limit));}
}
