Werner Lemberg pushed to branch master at FreeType / FreeType
Commits:
-
ff407765
by Werner Lemberg at 2021-06-25T09:24:07+02:00
4 changed files:
Changes:
1 |
+2021-06-25 Werner Lemberg <wl@gnu.org>
|
|
2 |
+ |
|
3 |
+ [base] Add trace level to logging output.
|
|
4 |
+ |
|
5 |
+ Some practical debugging work has shown that displaying level X of
|
|
6 |
+ an `FT_TRACEX` macro in the output of `FT2_DEBUG="... -v"` would be
|
|
7 |
+ very helpful to find out which trace level should be selected. As
|
|
8 |
+ an example, we now get output like
|
|
9 |
+ |
|
10 |
+ ```
|
|
11 |
+ [ttobjs:2] TTF driver
|
|
12 |
+ [ttobjs:2] SFNT driver
|
|
13 |
+ [sfobjs:2] not a font using the SFNT container format
|
|
14 |
+ [t1objs:2] Type 1 driver
|
|
15 |
+ [stream:7] FT_Stream_EnterFrame: 14 bytes
|
|
16 |
+ ```
|
|
17 |
+ |
|
18 |
+ * include/freetype/internal/ftdebug.h (FT_LOGGING_TAGX): New macro.
|
|
19 |
+ (FT_LOG): Use it to add the trace level to the logging tag.
|
|
20 |
+ |
|
21 |
+ * include/freetype/internal/fttrace.h (FT_MAX_TRACE_LEVEL_LENGTH):
|
|
22 |
+ Adjust.
|
|
23 |
+ |
|
24 |
+ * docs/DEBUG: Updated.
|
|
25 |
+ |
|
1 | 26 |
2021-06-24 Alexei Podtelezhnikov <apodtele@gmail.com>
|
2 | 27 |
|
3 | 28 |
[smooth, raster] Fix up and align error codes.
|
... | ... | @@ -168,7 +168,7 @@ behaviour of FreeType at runtime. |
168 | 168 |
If `FT_DEBUG_LOGGING' is defined, two more options are available.
|
169 | 169 |
|
170 | 170 |
* -v: Print also the name of FreeType's component from which the
|
171 |
- current log is produced.
|
|
171 |
+ current log is produced, together with the tracing level.
|
|
172 | 172 |
|
173 | 173 |
* -t: Print also the time.
|
174 | 174 |
|
... | ... | @@ -176,7 +176,7 @@ behaviour of FreeType at runtime. |
176 | 176 |
|
177 | 177 |
FT2_DEBUG="any:7 memory:5 -vt"
|
178 | 178 |
|
179 |
- => [20:32:02:44969 ttload] table directory loaded
|
|
179 |
+ => [20:32:02:44969 ttload:2] table directory loaded
|
|
180 | 180 |
|
181 | 181 |
FT2_DEBUG="any:7 memory:5 -t"
|
182 | 182 |
|
... | ... | @@ -184,7 +184,7 @@ behaviour of FreeType at runtime. |
184 | 184 |
|
185 | 185 |
FT2_DEBUG="any:7 memory:5 -v"
|
186 | 186 |
|
187 |
- => [ttload] table directory loaded
|
|
187 |
+ => [ttload:2] table directory loaded
|
|
188 | 188 |
|
189 | 189 |
|
190 | 190 |
FT_LOGGING_FILE
|
... | ... | @@ -114,11 +114,16 @@ FT_BEGIN_HEADER |
114 | 114 |
#define FT_LOGGING_TAG( x ) FT_LOGGING_TAG_( x )
|
115 | 115 |
#define FT_LOGGING_TAG_( x ) #x
|
116 | 116 |
|
117 |
+ /* we need two macros to convert the component and the trace level */
|
|
118 |
+ /* to a string that combines them */
|
|
119 |
+#define FT_LOGGING_TAGX( x, y ) FT_LOGGING_TAGX_( x, y )
|
|
120 |
+#define FT_LOGGING_TAGX_( x, y ) #x ":" #y
|
|
121 |
+ |
|
117 | 122 |
|
118 | 123 |
#define FT_LOG( level, varformat ) \
|
119 | 124 |
do \
|
120 | 125 |
{ \
|
121 |
- const char* dlg_tag = FT_LOGGING_TAG( FT_COMPONENT ); \
|
|
126 |
+ const char* dlg_tag = FT_LOGGING_TAGX( FT_COMPONENT, level ); \
|
|
122 | 127 |
\
|
123 | 128 |
\
|
124 | 129 |
ft_add_tag( dlg_tag ); \
|
... | ... | @@ -19,8 +19,9 @@ |
19 | 19 |
/* definitions of trace levels for FreeType 2 */
|
20 | 20 |
|
21 | 21 |
/* the maximum string length (if the argument to `FT_TRACE_DEF` */
|
22 |
- /* gets used as a string) */
|
|
23 |
-#define FT_MAX_TRACE_LEVEL_LENGTH 9
|
|
22 |
+ /* gets used as a string) plus one charachter for ':' plus */
|
|
23 |
+ /* another one for the trace level */
|
|
24 |
+#define FT_MAX_TRACE_LEVEL_LENGTH (9 + 1 + 1)
|
|
24 | 25 |
|
25 | 26 |
/* the first level must always be `trace_any' */
|
26 | 27 |
FT_TRACE_DEF( any )
|