-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[source_loc] support for owning strings #2867
Comments
First, unless you are using IMO. As far as I can see |
@tt4g, the analysis is basically the same conclusion that i came to: it would require a separate API in order to support |
spdlog uses the fmt library to format log messages. |
Right, other ways would require significant modifications to the API. The fmt formatting is done in the log call site so it would work even if the |
formatting a
yes, this is more a feature request in order to ease the integration of spdlog with source location provided from a vm |
Custom formatter would execute in the async worker thread, so it could be done but care is needed in that regard. |
from my reading of the code, the filename formatters like %@ directly access that said: i wonder if the async formatters could ensure that the ownership of the strings that |
With the custom formatter you would need to implement some kind of mechanism for this.I am pretty sure it doesn't worth it. Easiest would be implementing user defined type. |
@gabime, as this ticket is closed as "completed", is there any change that i need to cherry-pick? i've been working on a patch to |
It was closed because there is no simple fix for this and the need for this feature is rare to be worth it. |
would you accept a patch that enables this feature via a preprocessor define? |
I prefer not to add complexity to the codebase for such a rare feature. |
source_loc
does not own the strings for file name and function name. this is a perfectly reasonable default in most use cases where this information is filled by the preprocessor.however i'm running into a funny situation when trying to re-direct qt's logging to spdlog and using multithreaded logging:
QMessageLogContext
with rawconst char*
pointers (compare https://github.com/qt/qtdeclarative/blob/abb9cde13d6d0f503a8a6aad12f4361cd3848c79/src/qml/qml/qqmlengine.cpp#L1580-L1605)QMessageLogContext
ontosource_loc
i've been meditating a bit about this. it's a bit of an edge case, but it would be great if spdlog could provide a second api similar to
source_loc
, that uses owningstd::string
to allow applications to fill asource_loc
from source locations other than c/c++The text was updated successfully, but these errors were encountered: