Skip to content

Commit

Permalink
main : pass LOG_TEE callback to llama.cpp log (#4033)
Browse files Browse the repository at this point in the history
* main : Call llama_log_set to use LOG_TEE

* tabs to spaces
  • Loading branch information
AndrewGodfrey committed Nov 30, 2023
1 parent 524907a commit 8efa0f6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ static void sigint_handler(int signo) {
}
#endif

static void llama_log_callback_logTee(ggml_log_level level, const char * text, void * user_data) {
(void) level;
(void) user_data;
LOG_TEE("%s", text);
}

int main(int argc, char ** argv) {
gpt_params params;
g_params = &params;
Expand All @@ -113,6 +119,7 @@ int main(int argc, char ** argv) {
log_set_target(log_filename_generator("main", "log"));
LOG_TEE("Log start\n");
log_dump_cmdline(argc, argv);
llama_log_set(llama_log_callback_logTee, nullptr);
#endif // LOG_DISABLE_LOGS

// TODO: Dump params ?
Expand Down

0 comments on commit 8efa0f6

Please sign in to comment.