Skip to content
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

Log level enhancements #2

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chrysn
Copy link
Member

@chrysn chrysn commented Apr 26, 2023

Dumping ERROR messages (eg. in RIOT using [^1]) makes SYNC messages show. While they are much rarer than the rest of the INFO level output, they're still not errors. So, let's either demote them to info or introduce more fine grained logging. Either way, chances are there are other similar errors that should be rolled up in this PR.

It'd be tempting to go a step further and make it print the output in hex, eg. using

LOG_INFO("SYNC " << params.syncParentSdIndex << " " <<  std::format("{:#04x}", params.syncParentShortAddress));

but the #include <format> header would at least require c++23 and we're currently at 14. (Yes there is << std::hex << params.syncParentShortAddress, but I loathe that mechanism's statefulness).

[^1]: Enabling error logging in RIOT
diff --git a/pkg/opendsme/include/opendsme/dsme_platform.h b/pkg/opendsme/include/opendsme/dsme_platform.h
index cfaa3a547f..08dfcabbfe 100644
--- a/pkg/opendsme/include/opendsme/dsme_platform.h
+++ b/pkg/opendsme/include/opendsme/dsme_platform.h
@@ -23,0 +24 @@
+#include <iostream>
@@ -36 +37 @@ extern "C" {
-#define LOG_ERROR(x)
+#define LOG_ERROR(x) std::cout << x << std::endl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant