-
Notifications
You must be signed in to change notification settings - Fork 37
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
Experimenting with spdlog #615
Conversation
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Unsure if the comment is out of the scope of this work, please ignore it if it is. The current implementation seems to support different "sinks" (destinations for the logging) in the sense that I can see the fileSink and consoleSink in the implementation of the I think that supported this variety of "sinks" is really a great approach so we can extend the logging capabilities in the future. Concretely I'm looking into experimenting with OpenTelemetry for the whole Gazebo and one of the options that this spdlog support can provide is the use of an "OpenTelemetry sink". The creation of it seems trivial if we can support multiple sinks somehow: #include <opentelemetry/instrumentation/spdlog/sink.h>
auto otel_sink = std::make_shared<spdlog::sinks::opentelemetry_sink_mt>();
otel_sink->set_level(spdlog::level::info);
auto logger = spdlog::logger("OTelLogger", otel_sink); |
That is correct. I used In this implementation, I wanted to make sure that we can surface the underlying spdlog mechanisms so you could (for instance) add an OpenTelemetry sink to Console. |
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Would it make sense to move this into gz-utils? We have an implementation of |
Signed-off-by: Carlos Agüero <[email protected]>
@mjcarroll and I discussed putting a lightweight wrapper around |
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
…o mjcarroll/spdlog
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #615 +/- ##
==========================================
+ Coverage 80.54% 84.92% +4.38%
==========================================
Files 80 78 -2
Lines 13588 10094 -3494
==========================================
- Hits 10944 8572 -2372
+ Misses 2644 1522 -1122 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Carlos Agüero <[email protected]>
update migration guide? |
Signed-off-by: Carlos Agüero <[email protected]>
I tested this with gz-sim's
|
Signed-off-by: Carlos Agüero <[email protected]>
Updated in 27633b7 |
EXPECT_TRUE(logContent.find("**test** [Wrn]") != std::string::npos); | ||
EXPECT_TRUE(logContent.find("**test** [Msg]") != std::string::npos); | ||
EXPECT_TRUE(logContent.find("**test** [Dbg]") != std::string::npos); | ||
EXPECT_TRUE(logContent.find("**test** error") != std::string::npos); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a behavior change on the formatting of the logs? Should this be included in the migration guide?
Added
windows has |
Could you try with this PR? gazebosim/gz-utils#139 I think we should use a period flush for efficiency but we might be doing something wrong and I suspect it's related with the use of |
tested and confirmed it fixes the issues. |
Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
* Remove flushes and fix tests Signed-off-by: Addisu Z. Taddese <[email protected]> * Remove doxygen parameter Signed-off-by: Carlos Agüero <[email protected]> --------- Signed-off-by: Addisu Z. Taddese <[email protected]> Signed-off-by: Carlos Agüero <[email protected]> Co-authored-by: Carlos Agüero <[email protected]>
@Mergifyio backport gz-common6 |
✅ Backports have been created
|
* spdlog logging integration. Signed-off-by: Michael Carroll <[email protected]> Signed-off-by: Carlos Agüero <[email protected]> Signed-off-by: Addisu Z. Taddese <[email protected]> (cherry picked from commit 6cb5a53)
* spdlog logging integration. Signed-off-by: Michael Carroll <[email protected]> Signed-off-by: Carlos Agüero <[email protected]> Signed-off-by: Addisu Z. Taddese <[email protected]> (cherry picked from commit 6cb5a53)
No description provided.