Skip to content

Commit 98a3b77

Browse files
committed
py\mpprint.h: MP_PRN() is off by default.
1 parent 1774cbb commit 98a3b77

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

py/mpprint.h

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,16 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args);
8080
#endif
8181

8282
// Debug messages during code developing with MP_PRN(level, ...) & MP_PRN_LEVEL.
83-
// An approximate hierarchy of debug levels (MP_PRN_LEVEL) is:
84-
// 0 - SUPPRES all messages. Use it in release version.
85-
// 1 - The most CRITICAL errors, often requiring a system reset, use message with this level if possible raising an exception.
83+
// An approximate hierarchy of debug levels MP_PRN_LEVEL is:
84+
// 0 - SUPPRESS all messages. Use it in the release version.
85+
// 1 - For the most CRITICAL errors, often requiring a system reset. Use a message with this level, if possible, raising an exception.
8686
// 2 - ERROR requiring program restart, use message with this level before raising an exception.
8787
// 3 - WARNING, something went wrong, but you can fix it with additional operations in code right now or may ignore it.
8888
// 4 - INFO, it is interesting and useful for understanding a bug.
89-
// 5 - DEBUG, more detaled info, dig deeper.
90-
// 6 - TRACE, show algorithm flow, like enter/exit a function.
91-
// In real you may use own classification of debug levels.
89+
// 5 - DEBUG, more detailed information, dig deeper.
90+
// 6 - TRACE, show a flow of the algorithm, like enter/exit a function.
91+
// In reality, you may use your own classification of debug levels.
92+
#if defined(MP_PRN_LEVEL) && (MP_PRN_LEVEL > 0)
9293
#define MP_PRN(level, ...) \
9394
do { \
9495
if (MP_PRN_LEVEL > 0) { \
@@ -99,6 +100,9 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args);
99100
} \
100101
} \
101102
} while (0);
103+
#else
104+
#define MP_PRN(level, ...)
105+
#endif
102106
/*
103107
// How to use:
104108
// Set MP_PRN_LEVEL in developed *.C or *.CPP file, for example
@@ -122,12 +126,6 @@ void foo() {
122126
#define MP_PRN_LEVEL 3
123127
// 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, ...)
124128
// Then you may change MP_PRN_LEVEL to 2(reduce printing), and finally to 0(supress printing).
125-
//
126-
// To switching off MP_PRN() from a compiled binary, use
127-
#ifdef MP_PRN
128-
#undef MP_PRN
129-
#define MP_PRN(level, ...)
130-
#endif
131129
*/
132130

133131
#endif // MICROPY_INCLUDED_PY_MPPRINT_H

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy