Skip to content

Commit 8efa0f6

Browse files
main : pass LOG_TEE callback to llama.cpp log (#4033)
* main : Call llama_log_set to use LOG_TEE * tabs to spaces
1 parent 524907a commit 8efa0f6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

examples/main/main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ static void sigint_handler(int signo) {
100100
}
101101
#endif
102102

103+
static void llama_log_callback_logTee(ggml_log_level level, const char * text, void * user_data) {
104+
(void) level;
105+
(void) user_data;
106+
LOG_TEE("%s", text);
107+
}
108+
103109
int main(int argc, char ** argv) {
104110
gpt_params params;
105111
g_params = &params;
@@ -113,6 +119,7 @@ int main(int argc, char ** argv) {
113119
log_set_target(log_filename_generator("main", "log"));
114120
LOG_TEE("Log start\n");
115121
log_dump_cmdline(argc, argv);
122+
llama_log_set(llama_log_callback_logTee, nullptr);
116123
#endif // LOG_DISABLE_LOGS
117124

118125
// TODO: Dump params ?

0 commit comments

Comments
 (0)