-
Notifications
You must be signed in to change notification settings - Fork 15
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
added silly and critical trace levels #80
base: master
Are you sure you want to change the base?
Conversation
f7bf781
to
551e97c
Compare
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.
Looks good.
#endif | ||
|
||
//usage macros: | ||
#if MBED_TRACE_MAX_LEVEL >= TRACE_LEVEL_SILLY && !defined(tr_silly) |
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.
tr_silly could cause conflict if somebody define it after including this header but maybe we shouldn’t do any more hacks in here
This might require some testing as this seems to break the tracing of existing applications. |
could you point what breaks so I could fix it? |
this way we doesn't break any API
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.
Basically fine with the change, but I would vaguely prefer to make better use of higher-than-debug levels. That would be harder work though. See comment on issue #79
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.
Some of the traces are not visible with internal test application.
|
||
/** this print is some silly deep information for debug purpose */ | ||
#define TRACE_LEVEL_SILLY 0x07 |
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.
Should it be just called DEEP rather than SILLY?
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.
I'm fine with both keys. I just pick silly
keyword from winston library :) Votes ?
I've updated PR and covered all comments, except these:
Any opinions ?
Another approach is to drop whole PR and change our code base so that traces are more relevant level... -> Question are: Do we really need more verbose levels ? Can't we use existing levels better ? |
We are already in problem with too much traces and adding more levels is just encouraging people to trace more, and trace even silly things... So.. I'm not sure this is good thing. What exactly are the differences between |
True. Can we survive with existing trace levels or not? @teetak01 can you give more details why you asked #79 originally ? What was the actual problem ?
I've same feeling..
depends on how we want to use it, but I would guess that warning means something like something wrong happens but code can survive with it, and critical is something more dramatical that something might not work anymore as expected... |
Well, I think there would be some benefit of being able to seperate some debug-level tracing to silly. Of course I agree that @SeppoTakalo concern is probably valid. Silly-like level could be used for extensive diagnostic output (including IN/OUT tracing) when we know something is broken, but only can ask customer to provide some logs. But if you think that this is more trouble than benefit, the issue can also be rejected. I do not see much benefit for tr_critical(). For Mbed OS this would effectively be MBED_ERROR(), and in case of Client, in such fatal cases, we could just call platform-level reboot, if we would think that the library could go to such broken state we cannot recover anymore. |
Even if warning and error are logically different, I still don't see the need to have those as separate debug levels but I'm not hardly against, if you see the need. I would be happy with 3 levels: debug, info, warning. Syslog seems to have 7 severity levels. I would prefer to unify our levels to match those. |
There should be some guidelines in telling people what log level is meant for that, preferrably with some good examples. Easier said than done, though. :-) |
Well, the syslog seems to have sensible description for different levels, and are mostly in line how mbed-trace currently is used. |
Strongly agree with syslog consistency. As I said in #79, adding silly is effectively a backwards-compatible attempt to deal with our overuse of "debug", but it locks in our not-syslogness. Most of our traces should be higher level, really. (Quoting from myself: "Most of our infos should be notice, and a lot of our debug should be info.") |
Note that in Linux, you would never just turn on "debug" for the whole system - it's very much a per-component thing. Whole system would bring it to its knees. Which suggests it is very much "silly"... |
mbed-trace currently has only a limited functionality for controlling component-specific tracing at compile-time #59 |
Had some discussion back in April with @jupe about this, following #76. Whatever your "maximum" trace level is, be it "debug" or "silly", you really do want to have it compile-time per-component selectable in some way. The lack of that is currently forcing local instances of
I was starting to think about how to do that generally with token pasting nonsense - something like JSON:
leading to C defines Then in "mbed_trace.h" start pasting Only got as far as hand-waving about it though. |
I would vote to drop these new trace levels (=reject #80 and #79, focus component based trace activation feature that @kjbracey-arm mentioned and update existing traces more appropriate levels. Is it okay for others ? This of course causes some work for teams to review component traces and re-think trace levels they uses.. Maybe that is not bad idea afterall - I'm pretty sure that there is some cleanup to do anyway.. |
Status
READY/HOLD
Description
added silly and critical trace levels. Replace bitmask debug levels as number.
New API's
critical traces are colored with red background, silly traces are with same colors than debug traces (gray).
Related issues:
Fixes #79
Todo