Skip to content
Closed
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);
Comment on lines +41 to +45
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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);
fputs(data->stringStream->str().c_str(), stderr);
fflush(stderr);

No need for so many comments

}

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);
Comment on lines +84 to +87
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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);
fputs(text, stderr);
fflush(stderr);

No need for so many comments

}
}

Expand Down