<?php
namespace NeoAnimateBeta\NeoLog; if (!defined("ABSPATH")) { die("neoWP direct access not allowed"); }




\NeoAnimateBeta\NeoGlobal\add_action_hook("current_screen", function () {
    $log_message = \NeoAnimateBeta\NeoGlobal\json_encode_better(["siteHost" => \NeoAnimateBeta\NeoGlobal\site_host(), "activePlugins" => \NeoAnimateBeta\NeoEntrypoint\get_neo_active_plugins(), "wpVersion" => get_bloginfo("version"), "phpVersion" => phpversion(), "plugins" => get_option("active_plugins"), "wpContentPath" => WP_CONTENT_DIR]);
    
    $global_log_path = \NeoAnimateBeta\NeoGlobal\cache_path("neo-log") . "/neo-log--plugin-changes.log";
    $get_last_non_empty_line = function ($file_path) { return !\NeoAnimateBeta\NeoGlobal\fs_file_exists($file_path) ? null : ((($file = new \SplFileObject($file_path, "r")) && $file->seek(PHP_INT_MAX) === null && ($line = trim($file->current())) !== "") ? $line : ((($file->key() > 0 && $file->seek($file->key() - 1) === null && ($line = trim($file->current())) !== "")) ? $line : (($file->seek(0) === null && ($line = trim($file->current())) !== "") ? $line : null))); };
    try { $last_global_log_message = \NeoAnimateBeta\NeoGlobal\json_decode_better($get_last_non_empty_line($global_log_path) ?? "{}")["message"] ?? null; } catch (\Throwable $error) { $last_global_log_message = null; }
    if ($last_global_log_message == $log_message) { return; }
    
    \NeoAnimateBeta\NeoGlobal\global_log_with_module_name("neo-log", $log_message, log_source: "neo-log--plugin-changes");
});
