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






function get_caller_log_source() {
    $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);

    foreach ($backtrace as $frame) {
        if (!isset($frame["file"])) { continue; }
        if ($frame["file"] === __FILE__) { continue; }
        if (str_ends_with($frame["file"], "neo-log---init.php") || str_ends_with($frame["file"], "_global--log.php")) { continue; }
        if (str_ends_with($frame["file"], "_global--interface.php"))                                                  { continue; }
        try { $rel_path = \NeoLibraryFull\NeoGlobal\make_plugin_file_path_relative($frame["file"]); } catch (\NeoLibraryFull\NeoGlobal\GlobalException $e) { if (str_starts_with($e->getMessage(), "Invalid absolute path: ")) { return $frame["file"]; } throw $e; }
        return \NeoLibraryFull\NeoGlobal\get_module_name($rel_path) !== "neo-global" ? \NeoLibraryFull\NeoGlobal\get_module_name($rel_path) : pathinfo($frame["file"], PATHINFO_FILENAME);
    }
    return "[Unknown log source]";
}
