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

Console/Terminal Log standardization #2135

Open
Odyno opened this issue Dec 17, 2024 · 5 comments
Open

Console/Terminal Log standardization #2135

Odyno opened this issue Dec 17, 2024 · 5 comments

Comments

@Odyno
Copy link
Contributor

Odyno commented Dec 17, 2024

Is your feature request related to a problem? Please describe.
It seems to me that if we have 2 or 3 modules enabled (like RF + BT + IR) it is very difficult to understand the logs on the console because each module writes something when requested without providing context (probably all assuming only their own module is active). Sometimes you log multi-lines not with a simple call to the LOG function but with a call to multiple LOGs... this makes it a nightmare to understand the flow.

Describe the solution you'd like
Having a clear console register in which registers are always contextualised and encapsulated.

Describe alternatives you've considered
Create a soft rules like:
A - The log need to have a prefix the module involved (Example "BT .... " or "RF ..." etc )
B - The log need to be encapsulated:

As example:

        Log.trace(F("Looking for Model_id: %d" CR), p->sensorModel_id);
        std::string properties = decoder.getTheengProperties(p->sensorModel_id);
        Log.trace(F("properties: %s" CR), properties.c_str());

should be

        Log.trace(F("BT - Looking for Model_id: %d with properties: %s" CR), 
                         p->sensorModel_id, 
                        decoder.getTheengProperties(p->sensorModel_id).c_str()
        );
@benzok
Copy link
Contributor

benzok commented Dec 19, 2024

or we could use a macro; perhaps something like this

#define LOG_TRACE(...) {               \
        Log.trace("%s: " , __FILE__);  \
        Log.trace(__VA_ARGS__);        \
}

and replace the 'Log.trace' with 'LOG_TRACE' and we would get the filename main/ZgatewayBT.ino as a prefix to the log message

@h2zero
Copy link
Collaborator

h2zero commented Dec 19, 2024

Since we are only building for ESP devices now I would suggest replacing the log library with the ESP_LOG macros and then we could use log tag filtering.

@Odyno
Copy link
Contributor Author

Odyno commented Dec 19, 2024

I'm sorry, I didn't understand the next sentence....

Since we are only building for ESP devices now I would suggest replacing the log library with the ESP_LOG macros and then we could use log tag filtering.

so, OMG will be only ESP device?

@h2zero
Copy link
Collaborator

h2zero commented Dec 19, 2024

I thought we only had builds for ESP devices, or am I missing something?

@1technophile
Copy link
Owner

so, OMG will be only ESP device?

1.8.0 supports only ESP devices

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

No branches or pull requests

4 participants