22 auto path = log_dir /
"session_model.log";
23 fp_ = fopen(path.string().c_str(),
"a");
25 s_log->warn(
"cannot open model log: {}", path.string());
35 if (fp_) { fclose(fp_); }
46 fprintf(fp_,
"--- USER ---\n%s\n--- ASSISTANT ---\n", input.c_str());
58 if (!fp_ || !token || len == 0) {
return; }
59 fwrite(token, 1, len, fp_);
81 return fp_ !=
nullptr;
93 const char* token,
size_t len,
void* user_data) {
Manages session_model.log for raw streaming content.
ENTROPIC_EXPORT ~SessionLogger()
Close the model log file.
ENTROPIC_EXPORT bool is_open() const
Check if the logger is open and writable.
ENTROPIC_EXPORT void log_user_input(const std::string &input)
Log user input at the start of a turn.
static void raw_token_callback(const char *token, size_t len, void *user_data)
Static callback for StreamThinkFilter raw output.
ENTROPIC_EXPORT void log_raw_token(const char *token, size_t len)
Log a raw token from streaming output.
ENTROPIC_EXPORT SessionLogger(const std::filesystem::path &log_dir)
Construct with log directory.
ENTROPIC_EXPORT void end_turn()
End the current assistant turn.
spdlog initialization and logger access.
ENTROPIC_EXPORT std::shared_ptr< spdlog::logger > get(const std::string &name)
Get or create a named logger.
Activate model on GPU (WARM → ACTIVE).
Session model log — raw streaming transcript.