51 std::chrono::system_clock::now()};
139 std::unique_ptr<Impl> impl_;
152 [[nodiscard]] std::vector<TraceEvent>
events()
const;
161 mutable std::mutex mutex_;
162 std::vector<TraceEvent> events_;
211 std::unique_ptr<Impl> impl_;
215using Tracers = std::vector<std::shared_ptr<Tracer>>;
Human-readable stderr tracer.
Definition tracing.hpp:89
void record(const TraceEvent &event) override
Writes one human-readable event to standard error.
Definition tracing.hpp:124
FileTracer(std::string path, FileTracerOptions options={})
Opens a JSON Lines trace file at path.
void record(const TraceEvent &event) override
Appends one event subject to the configured payload and size policy.
Definition tracing.hpp:170
std::function< void(const TraceEvent &)> Function
Callback signature for one structured event.
Definition tracing.hpp:173
void record(const TraceEvent &event) override
Delegates one event to the configured callback.
FunctionTracer(Function function)
Creates a tracer that forwards events to function.
Thread-safe tracer that retains events for tests and embedding applications.
Definition tracing.hpp:143
std::vector< TraceEvent > events() const
Returns a thread-safe snapshot of retained events.
void record(const TraceEvent &event) override
Retains a copy of one event.
void clear()
Removes all retained events.
Definition tracing.hpp:196
void record(const TraceEvent &event) override
Sends one metadata-only event to POSIX syslog.
SyslogTracer(std::string identity="neuralplus", int facility=0)
Creates a POSIX syslog destination with an identity prefix and facility.
Thread-safe destination for tracing and optional logging.
Definition tracing.hpp:73
virtual void record(const TraceEvent &event)=0
Records one structured lifecycle event.
JSON Lines file tracer settings.
Definition tracing.hpp:105
bool include_payloads
Persist TraceEvent::payload in addition to metadata.
Definition tracing.hpp:113
bool flush_each_event
Flush the stream after every event.
Definition tracing.hpp:110
bool append
Append to an existing file instead of truncating it.
Definition tracing.hpp:107
std::size_t max_bytes
Stop accepting events at this many bytes; zero means unlimited.
Definition tracing.hpp:116
One metadata-first trace record.
Definition tracing.hpp:42
std::string name
Model or tool name.
Definition tracing.hpp:63
std::string operation_id
Provider round or tool-call identifier.
Definition tracing.hpp:60
TraceEventType type
Lifecycle category.
Definition tracing.hpp:47
JsonValue attributes
Metadata safe for the configured tracing policy.
Definition tracing.hpp:66
std::string payload
Optional sensitive payload, empty unless explicitly enabled.
Definition tracing.hpp:69
std::string session_id
Session correlation identifier.
Definition tracing.hpp:54
std::chrono::system_clock::time_point timestamp
Wall-clock timestamp captured when the event is created.
Definition tracing.hpp:50
TraceLevel level
Event severity.
Definition tracing.hpp:44
std::string run_id
Generation correlation identifier.
Definition tracing.hpp:57
NEURALPLUS_API const char * to_string(TraceLevel level) noexcept
Returns the stable SDK spelling of a trace level.
TraceEventType
Stable lifecycle event categories emitted by AIClient.
Definition tracing.hpp:31
TraceLevel
Severity used by structured tracing and optional logging.
Definition tracing.hpp:23
std::vector< std::shared_ptr< Tracer > > Tracers
Shared tracer collection accepted by ClientOptions.
Definition tracing.hpp:215
nlohmann::json JsonValue
Definition types.hpp:26