8000 Update mpprint.h · micropython/micropython@e29f363 · GitHub
[go: up one dir, main page]

Skip to content

Commit e29f363

Browse files
committed
Update mpprint.h
1 parent a7a4c4e commit e29f363

File tree

1 file changed

+0
-59
lines changed

1 file changed

+0
-59
lines changed

py/mpprint.h

100644100755
Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -80,62 +80,3 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args);
8080
#endif
8181

8282
#endif // MICROPY_INCLUDED_PY_MPPRINT_H
83-
84-
#if defined(MP_PRN_LEVEL) && (MP_PRN_LEVEL > 0)
85-
// Debug messages during code developing with MP_PRN(level, ...) & MP_PRN_LEVEL.
86-
// An approximate hierarchy of debug levels MP_PRN_LEVEL is:
87-
#define MP_PRN_SUPPRESS 0 // SUPPRESS all messages. Use it in the release version.
88-
#define MP_PRN_CRITICAL 1 // For the most CRITICAL errors, often requiring a system reset. Use a message with this level, if possible, raising an exception.
89-
#define MP_PRN_ERROR 2 // ERROR requiring program restart, use message with this level before raising an exception.
90-
#define MP_PRN_WARNING 3 // WARNING, something went wrong, but you can fix it with additional operations in code right now or may ignore it.
91-
#define MP_PRN_INFO 4 // INFO, it is interesting and useful for understanding a bug.
92-
#define MP_PRN_DEBUG 5 // DEBUG, more detailed information, dig deeper.
93-
#define MP_PRN_TRACE 6 // TRACE, show a flow of the algorithm, like enter/exit a function.
94-
// In reality, you may use your own classification of debug levels.
95-
96-
#if defined(MP_PRN)
97-
#undef MP_PRN
98-
#endif
99-
100-
#define MP_PRN(level, ...) \
101-
do { \
102-
if ((0 < level) && (level <= MP_PRN_LEVEL)) { \
103-
mp_printf(MP_PYTHON_PRINTER, " %d || ", level); \
104-
mp_printf(MP_PYTHON_PRINTER, __VA_ARGS__); \
105-
mp_printf(MP_PYTHON_PRINTER, " || %d %s\n", __LINE__, __FILE__); \
106-
} \
107-
} while (0);
108-
#else
109-
#define MP_PRN(level, ...)
110-
#endif
111-
/*
112-
// How to use:
113-
// Set MP_PRN_LEVEL in developed *.C or *.CPP file, for example
114-
#define MP_PRN_LEVEL 1000 // show all messages
115-
// Add MP_PRN() macro in code, like
116-
void foo() {
117-
MP_PRN(6, "Enter foo()")
118-
...
119-
int value;
120-
...
121-
// calculate value
122-
...
123-
MP_PRN(4, "See a value=%d", value)
124-
...
125-
MP_PRN(6, "Exit foo()")
126-
}
127-
// It is not a dogma. You may start debugging from level 3.
128-
#define MP_PRN_LEVEL 3
129-
// Then add MP_PRN(3, ...) and when gets too much messages then change some messages to the next level MP_PRN(4, ...), or MP_PRN(2, ...) etc.
130-
// Then you may change MP_PRN_LEVEL to 2(reduce printing), and finally to 0(supress printing).
131-
*/
132-
133-
#if 0
134-
#if MICROPY_DEBUG_VERBOSE // print debugging info
135-
#define DEBUG_PRINT (1)
136-
#define DEBUG_printf(...) MP_PRN(MP_PRN_DEBUG, __VA_ARGS__)
137-
#else // don't print debugging info
138-
#define DEBUG_PRINT (0)
139-
#define DEBUG_printf(...)
140-
#endif
141-
#endif

0 commit comments

Comments
 (0)
0