From 8b4a28bf3f37bcf27c3459e15cfbf82f1c554ddd Mon Sep 17 00:00:00 2001 From: Andrew Godfrey Date: Fri, 10 Nov 2023 21:27:02 -0800 Subject: [PATCH 1/2] main : Call llama_log_set to use LOG_TEE --- examples/main/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/main/main.cpp b/examples/main/main.cpp index 8d985c82ac21a..a4061663ef82d 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -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 = ¶ms; @@ -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 ? From ffa494eb141bd0c8fcf1976e7bba6603b31fe035 Mon Sep 17 00:00:00 2001 From: Andrew Godfrey Date: Mon, 13 Nov 2023 17:14:16 -0800 Subject: [PATCH 2/2] tabs to spaces --- examples/main/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/main/main.cpp b/examples/main/main.cpp index a4061663ef82d..c70259f8d4803 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -101,9 +101,9 @@ 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); + (void) level; + (void) user_data; + LOG_TEE("%s", text); } int main(int argc, char ** argv) { @@ -119,7 +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); + llama_log_set(llama_log_callback_logTee, nullptr); #endif // LOG_DISABLE_LOGS // TODO: Dump params ?