Skip to content

Commit 9709026

Browse files
committed
Update logging documentation
1 parent b82cc73 commit 9709026

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ try (LlamaModel model = new LlamaModel(modelParams)) {
228228
Per default, logs are written to stdout.
229229
This can be intercepted via the static method `LlamaModel.setLogger(LogFormat, BiConsumer<LogLevel, String>)`.
230230
There is text- and JSON-based logging. The default is JSON.
231+
Note, that text-based logging will include additional output of the GGML backend, while JSON-based logging
232+
only provides request logs (while still writing GGML messages to stdout).
231233
To only change the log format while still writing to stdout, `null` can be passed for the callback.
232234
Logging can be disabled by passing an empty callback.
233235

src/main/java/de/kherud/llama/LlamaModel.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ public String decode(int[] tokens) {
9999

100100
/**
101101
* Sets a callback for native llama.cpp log messages.
102-
* Per default, log messages are written to stdout. To only change the log format but keep logging to stdout,
103-
* the given callback can be <code>null</code>.
102+
* Per default, log messages are written in JSON to stdout. Note, that in text mode the callback will be also
103+
* invoked with log messages of the GGML backend, while JSON mode can only access request log messages.
104+
* In JSON mode, GGML messages will still be written to stdout.
105+
* To only change the log format but keep logging to stdout, the given callback can be <code>null</code>.
104106
* To disable logging, pass an empty callback, i.e., <code>(level, msg) -> {}</code>.
105107
*
106108
* @param format the log format to use

0 commit comments

Comments
 (0)