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




\NeoLibraryFull\NeoGlobal\add_action_hook("current_screen", function () {
    $log_message = \NeoLibraryFull\NeoGlobal\json_encode_better(["siteHost" => \NeoLibraryFull\NeoGlobal\site_host(), "activePlugins" => \NeoLibraryFull\NeoEntrypoint\get_neo_active_plugins(), "wpVersion" => get_bloginfo("version"), "phpVersion" => phpversion(), "plugins" => get_option("active_plugins"), "wpContentPath" => WP_CONTENT_DIR]);

    $global_log_path = \NeoLibraryFull\NeoGlobal\cache_path("neo-log") . "/neo-log--plugin-changes.log";
    $get_last_non_empty_line = function ($file_path) { return !\NeoLibraryFull\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 = \NeoLibraryFull\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; }

    \NeoLibraryFull\NeoGlobal\global_log_with_module_name("neo-log", $log_message, log_source: "neo-log--plugin-changes");
});
