26#include <spdlog/spdlog.h>
27#include <spdlog/sinks/stdout_color_sinks.h>
33namespace entropic::log {
44ENTROPIC_EXPORT
void init(spdlog::level::level_enum level = spdlog::level::info);
57ENTROPIC_EXPORT
void add_file_sink(
const std::filesystem::path& path);
77ENTROPIC_EXPORT std::shared_ptr<spdlog::logger>
get(
const std::string& name);
89ENTROPIC_EXPORT
void setup_session(
const std::filesystem::path& log_dir);
128 const std::filesystem::path& log_dir);
200inline auto now() {
return std::chrono::steady_clock::now(); }
211 std::chrono::steady_clock::time_point start,
212 std::chrono::steady_clock::time_point end)
214 auto us = std::chrono::duration_cast<std::chrono::microseconds>(
216 return static_cast<double>(us.count()) / 1000.0;
233ENTROPIC_EXPORT std::string escape_content(
const std::string& text);
246ENTROPIC_EXPORT
void log_content(
247 const std::shared_ptr<spdlog::logger>& logger,
248 spdlog::level::level_enum level,
249 const std::string& label,
250 const std::string& text);
260ENTROPIC_EXPORT
void log_timing(
261 const std::shared_ptr<spdlog::logger>& logger,
262 const std::string& label,
273ENTROPIC_EXPORT
void log_tokens(
274 const std::shared_ptr<spdlog::logger>& logger,
287ENTROPIC_EXPORT
void log_decision(
288 const std::shared_ptr<spdlog::logger>& logger,
289 const std::string& label,
290 const std::string& key,
291 const std::string& value);
gh#59 (v2.3.1): RAII guard — sets thread's current handle_id.
Symbol visibility macro for all exported symbols.
ENTROPIC_EXPORT void add_file_sink(const std::filesystem::path &path)
Add a file sink to all loggers (truncated per run).
auto now()
Get current time for timing measurements.
ENTROPIC_EXPORT int current_handle_id()
gh#59 (v2.3.1): query the current thread's handle_id.
ENTROPIC_EXPORT std::shared_ptr< spdlog::logger > get(const std::string &name)
Get or create a named logger.
ENTROPIC_EXPORT void init(spdlog::level::level_enum level=spdlog::level::info)
Initialize the logging subsystem.
double elapsed_ms(std::chrono::steady_clock::time_point start, std::chrono::steady_clock::time_point end)
Compute elapsed milliseconds between two time points.
ENTROPIC_EXPORT void set_console_enabled(bool enabled)
Enable or disable the stderr console sink process-wide.
ENTROPIC_EXPORT void register_handle_log(int handle_id, const std::filesystem::path &log_dir)
gh#59 (v2.3.1): register a per-handle session.log file.
ENTROPIC_EXPORT void setup_session(const std::filesystem::path &log_dir)
Set up session logging for a project directory.
ENTROPIC_EXPORT void unregister_handle_log(int handle_id)
gh#59 (v2.3.1): release a handle's session.log file sink.
@ count
Sentinel — MUST remain last.