Skip to content

Commit 6f63a44

Browse files
committed
py\mpprint.h: Add __LINE__ and __FILE__.
1 parent 98a3b77 commit 6f63a44

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

py/mpprint.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,10 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args);
9292
#if defined(MP_PRN_LEVEL) && (MP_PRN_LEVEL > 0)
9393
#define MP_PRN(level, ...) \
9494
do { \
95-
if (MP_PRN_LEVEL > 0) { \
96-
if ((0 < level) && (level <= MP_PRN_LEVEL)) { \
97-
mp_printf(MP_PYTHON_PRINTER, "%d| ", level); \
98-
mp_printf(MP_PYTHON_PRINTER, __VA_ARGS__); \
99-
mp_printf(MP_PYTHON_PRINTER, "\n"); \
100-
} \
95+
if ((0 < level) && (level <= MP_PRN_LEVEL)) { \
96+
mp_printf(MP_PYTHON_PRINTER, " %d|| ", level); \
97+
mp_printf(MP_PYTHON_PRINTER, __VA_ARGS__); \
98+
mp_printf(MP_PYTHON_PRINTER, " ||%d %s\n", __LINE__, __FILE__); \
10199
} \
102100
} while (0);
103101
#else
@@ -108,6 +106,7 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args);
108106
// Set MP_PRN_LEVEL in developed *.C or *.CPP file, for example
109107
110108
#define MP_PRN_LEVEL 1000 // show all messages
109+
111110
// Add MP_PRN() macro in code, like
112111
void foo() {
113112
MP_PRN(6, "Enter foo()")
@@ -121,10 +120,9 @@ void foo() {
121120
MP_PRN(6, "Exit foo()")
122121
}
123122
124-
// See usage in ports/esp32/esp32_pcnt.c and ports/esp32/machine_pwm.c
125123
// It is not a dogma. You may start debugging from level 3.
126124
#define MP_PRN_LEVEL 3
127-
// 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, ...)
125+
// 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.
128126
// Then you may change MP_PRN_LEVEL to 2(reduce printing), and finally to 0(supress printing).
129127
*/
130128

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