Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions llama/addon/globals/addonLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ void addonCallJsLogCallback(
}

if (!called && data != nullptr) {
if (data->logLevelNumber == 2) {
fputs(data->stringStream->str().c_str(), stderr);
fflush(stderr);
} else {
fputs(data->stringStream->str().c_str(), stdout);
fflush(stdout);
}
// llama.cpp diagnostics go to stderr regardless of level —
// stdout is the host process's data / JSON-RPC channel and
// must not be polluted with library log lines.
fputs(data->stringStream->str().c_str(), stderr);
fflush(stderr);
}

if (data != nullptr) {
Expand Down Expand Up @@ -83,13 +81,10 @@ void addonLlamaCppLogCallback(ggml_log_level level, const char* text, void* user
}

if (text != nullptr) {
if (level == 2) {
fputs(text, stderr);
fflush(stderr);
} else {
fputs(text, stdout);
fflush(stdout);
}
// All llama.cpp log output goes to stderr — see the note in
// addonCallJsLogCallback; stdout is the host's data channel.
fputs(text, stderr);
fflush(stderr);
}
}

Expand Down