]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
main : pass LOG_TEE callback to llama.cpp log (#4033)
authorAndrew Godfrey <redacted>
Thu, 30 Nov 2023 21:56:19 +0000 (13:56 -0800)
committerGitHub <redacted>
Thu, 30 Nov 2023 21:56:19 +0000 (23:56 +0200)
* main : Call llama_log_set to use LOG_TEE

* tabs to spaces

examples/main/main.cpp

index 31ec8cade19be1fc1d6e0eb85b3031e4d6ba1032..c5cdfbf21b9547e2bdde8a21e58836729039a2a9 100644 (file)
@@ -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;
@@ -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 ?