-
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
Open
jupe
wants to merge
10
commits into
master
Choose a base branch
from
new_trace_levels
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1e1900d
add silly and critical trace levels
18b6da0
Merge branch 'master' into new_trace_levels
jupe 686eacb
use debug level as number instead of bitmask
22afa7a
Merge branch 'master' into new_trace_levels
287ebab
no message
3753af7
fixes and critical uses red background
87b9d05
fix test
093688e
another test fix
643920b
fix test
e357826
small style tuning
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,48 +81,62 @@ extern "C" { | |
and 5 lower bits are trace level configuration */ | ||
|
||
/** Config mask */ | ||
#define TRACE_MASK_CONFIG 0xE0 | ||
#define TRACE_MASK_CONFIG 0xF0 | ||
/** Trace level mask */ | ||
#define TRACE_MASK_LEVEL 0x1F | ||
#define TRACE_MASK_LEVEL 0x0F | ||
|
||
/** plain trace data instead of "headers" */ | ||
#define TRACE_MODE_PLAIN 0x80 | ||
#define TRACE_MODE_PLAIN 0x40 | ||
/** color mode */ | ||
#define TRACE_MODE_COLOR 0x40 | ||
#define TRACE_MODE_COLOR 0x20 | ||
/** Use print CR before trace line */ | ||
#define TRACE_CARRIAGE_RETURN 0x20 | ||
|
||
/** used to activate all trace levels */ | ||
#define TRACE_ACTIVE_LEVEL_ALL 0x1F | ||
/** print all traces same as above */ | ||
#define TRACE_ACTIVE_LEVEL_DEBUG 0x1f | ||
/** print info,warn and error traces */ | ||
#define TRACE_ACTIVE_LEVEL_INFO 0x0f | ||
/** print warn and error traces */ | ||
#define TRACE_ACTIVE_LEVEL_WARN 0x07 | ||
/** print only error trace */ | ||
#define TRACE_ACTIVE_LEVEL_ERROR 0x03 | ||
/** print only cmd line data */ | ||
#define TRACE_ACTIVE_LEVEL_CMD 0x01 | ||
/** trace nothing */ | ||
#define TRACE_ACTIVE_LEVEL_NONE 0x00 | ||
#define TRACE_CARRIAGE_RETURN 0x10 | ||
|
||
/** this print is some silly deep information for debug purpose */ | ||
#define TRACE_LEVEL_SILLY 0x07 | ||
/** this print is some deep information for debug purpose */ | ||
#define TRACE_LEVEL_DEBUG 0x10 | ||
#define TRACE_LEVEL_DEBUG 0x06 | ||
/** Info print, for general purpose prints */ | ||
#define TRACE_LEVEL_INFO 0x08 | ||
#define TRACE_LEVEL_INFO 0x05 | ||
/** warning prints, which shouldn't causes any huge problems */ | ||
#define TRACE_LEVEL_WARN 0x04 | ||
/** Error prints, which causes probably problems, e.g. out of mem. */ | ||
#define TRACE_LEVEL_ERROR 0x02 | ||
#define TRACE_LEVEL_ERROR 0x03 | ||
/** Critical prints, which causes critical problems */ | ||
#define TRACE_LEVEL_CRITICAL 0x02 | ||
/** special level for cmdline. Behaviours like "plain mode" */ | ||
#define TRACE_LEVEL_CMD 0x01 | ||
|
||
/** used to activate all trace levels */ | ||
#define TRACE_ACTIVE_LEVEL_ALL TRACE_LEVEL_SILLY | ||
/** print all traces same as above */ | ||
#define TRACE_ACTIVE_LEVEL_SILLY TRACE_LEVEL_SILLY | ||
/** print debug,warn, error and critical traces */ | ||
#define TRACE_ACTIVE_LEVEL_DEBUG TRACE_LEVEL_DEBUG | ||
/** print info, warn, error and critical traces */ | ||
#define TRACE_ACTIVE_LEVEL_INFO TRACE_LEVEL_INFO | ||
/** print warn, error and critical traces */ | ||
#define TRACE_ACTIVE_LEVEL_WARN TRACE_LEVEL_WARN | ||
/** print error and critical trace */ | ||
#define TRACE_ACTIVE_LEVEL_ERROR TRACE_LEVEL_ERROR | ||
/** print only critical trace */ | ||
#define TRACE_ACTIVE_LEVEL_CRITICAL TRACE_LEVEL_CRITICAL | ||
/** print only cmd line data */ | ||
#define TRACE_ACTIVE_LEVEL_CMD TRACE_LEVEL_CMD | ||
/** trace nothing */ | ||
#define TRACE_ACTIVE_LEVEL_NONE 0x00 | ||
jupe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#ifndef MBED_TRACE_MAX_LEVEL | ||
#define MBED_TRACE_MAX_LEVEL TRACE_LEVEL_DEBUG | ||
#define MBED_TRACE_MAX_LEVEL TRACE_LEVEL_CRITICAL | ||
jupe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#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 commentThe 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 |
||
#define tr_silly(...) mbed_tracef(TRACE_LEVEL_SILLY, TRACE_GROUP, __VA_ARGS__) //!< Print silly message | ||
#else | ||
#define tr_silly(...) | ||
#endif | ||
|
||
#if MBED_TRACE_MAX_LEVEL >= TRACE_LEVEL_DEBUG | ||
#define tr_debug(...) mbed_tracef(TRACE_LEVEL_DEBUG, TRACE_GROUP, __VA_ARGS__) //!< Print debug message | ||
#else | ||
|
@@ -151,6 +165,14 @@ extern "C" { | |
#define tr_err(...) | ||
#endif | ||
|
||
#if MBED_TRACE_MAX_LEVEL >= TRACE_LEVEL_CRITICAL | ||
#define tr_critical(...) mbed_tracef(TRACE_LEVEL_CRITICAL, TRACE_GROUP, __VA_ARGS__) //!< Print Critical Message | ||
jupe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#define tr_crit(...) mbed_tracef(TRACE_LEVEL_CRITICAL, TRACE_GROUP, __VA_ARGS__) //!< Alternative Critical message | ||
#else | ||
#define tr_critical(...) | ||
#define tr_crit(...) | ||
#endif | ||
|
||
#define tr_cmdline(...) mbed_tracef(TRACE_LEVEL_CMD, TRACE_GROUP, __VA_ARGS__) //!< Special print for cmdline. See more from TRACE_LEVEL_CMD -level | ||
|
||
//aliases for the most commonly used functions and the helper functions | ||
|
@@ -200,10 +222,12 @@ void mbed_trace_buffer_sizes(int lineLength, int tmpLength); | |
* TRACE_CARRIAGE_RETURN (print CR before trace line) | ||
* | ||
* TRACE_ACTIVE_LEVEL_ALL - to activate all trace levels | ||
* or TRACE_ACTIVE_LEVEL_DEBUG (alternative) | ||
* or TRACE_ACTIVE_LEVEL_SILLY (alternative) | ||
* TRACE_ACTIVE_LEVEL_DEBUG | ||
* TRACE_ACTIVE_LEVEL_INFO | ||
* TRACE_ACTIVE_LEVEL_WARN | ||
* TRACE_ACTIVE_LEVEL_ERROR | ||
* TRACE_ACTIVE_LEVEL_CRITICAL | ||
* TRACE_ACTIVE_LEVEL_CMD | ||
* TRACE_LEVEL_NONE - to deactivate all traces | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 ?