MCPcopy Index your code
hub / github.com/abetlen/llama-cpp-python / llama_log_callback

Function llama_log_callback

llama_cpp/_logger.py:31–43  ·  view source on GitHub ↗
(
    level: int,
    text: bytes,
    user_data: ctypes.c_void_p,
)

Source from the content-addressed store, hash-verified

29# typedef void (*ggml_log_callback)(enum ggml_log_level level, const char * text, void * user_data);
30@llama_cpp.llama_log_callback
31def llama_log_callback(
32 level: int,
33 text: bytes,
34 user_data: ctypes.c_void_p,
35):
36 # TODO: Correctly implement continue previous log
37 global _last_log_level
38 log_level = (
39 GGML_LOG_LEVEL_TO_LOGGING_LEVEL[level] if level != 5 else _last_log_level
40 )
41 if logger.level <= GGML_LOG_LEVEL_TO_LOGGING_LEVEL[level]:
42 print(text.decode("utf-8"), end="", flush=True, file=sys.stderr)
43 _last_log_level = log_level
44
45
46llama_cpp.llama_log_set(llama_log_callback, ctypes.c_void_p(0))

Callers

nothing calls this directly

Calls 1

decodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…