Add logging hooks to mtmd to allow redirection to appropriate log message sinks#17261
Closed
ankurvdev wants to merge 1 commit intoggml-org:masterfrom
ankurvdev:logging
Closed
Add logging hooks to mtmd to allow redirection to appropriate log message sinks#17261ankurvdev wants to merge 1 commit intoggml-org:masterfrom ankurvdev:logging
ankurvdev wants to merge 1 commit intoggml-org:masterfrom
ankurvdev:logging
Conversation
ngxson
requested changes
Nov 14, 2025
Contributor
ngxson
left a comment
There was a problem hiding this comment.
I don't think we need a whole callback system. Unless you have specific need, just a simple mtmd_helper_set_log_level(ggml_log_level) should do the trick
| #include <stddef.h> | ||
| #include <stdint.h> | ||
| #include <stdio.h> | ||
| #include <stdarg.h> |
| } | ||
| static mtmd_log_callback_t log_callback = log_callback_default; | ||
|
|
||
| void mtmd_set_log_callback(mtmd_log_callback_t callback) { |
Contributor
There was a problem hiding this comment.
Suggested change
| void mtmd_set_log_callback(mtmd_log_callback_t callback) { | |
| void mtmd_helper_set_log_callback(mtmd_helper_log_callback_t callback) { |
| int32_t n_batch, | ||
| llama_pos * new_n_past); | ||
|
|
||
| typedef void (*mtmd_log_callback_t)(enum ggml_log_level level, const char * fmt, ...); |
Contributor
There was a problem hiding this comment.
same here, prefix everything with mtmd_helper
Contributor
|
On second thought, it will be cleaner to implement the same pattern in LLAMA_API void llama_log_set(ggml_log_callback log_callback, void * user_data);Reusing |
Contributor
|
Superseded by #17268 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make sure to read the contributing guidelines before submitting a PR
Add logging hooks to mtmd so that the log messages from the library can be redirected to appropriate log message sinks as needed by the clients.
The main underlying issue is that log messages from mtmd are blindly emitted to stdout which pollute the stdout from llama-mtmd-cli as just a stream of model output.
Rework of an earlier PullRequest #17223 that was rejected because mtmd cannot take a dependency on libcommon which allow for log messages