@@ -284,27 +284,6 @@ typedef void(*zone_log_t)(
284
284
const char * , // message
285
285
void * ); // user data
286
286
287
- /**
288
- * @brief Write error message to active log handler.
289
- *
290
- * The zone parser operates on a per-record base and therefore cannot detect
291
- * errors that span records. e.g. SOA records being specified more than once.
292
- * The user may print a message using the active log handler, keeping the
293
- * error message format consistent.
294
- *
295
- * @param[in] parser Zone parser
296
- * @param[in] category Log category
297
- * @param[in] format Format string compatible with printf
298
- * @param[in] ... Variadic arguments corresponding to #format
299
- */
300
- ZONE_EXPORT void zone_log (
301
- zone_parser_t * parser ,
302
- uint32_t category ,
303
- const char * format ,
304
- ...)
305
- zone_nonnull ((1 ,3 ))
306
- zone_format_printf (3 ,4 );
307
-
308
287
typedef struct zone_name zone_name_t ;
309
288
struct zone_name {
310
289
uint8_t length ;
@@ -440,6 +419,82 @@ zone_parse_string(
440
419
void * user_data )
441
420
zone_nonnull ((1 ,2 ,3 ,4 ));
442
421
422
+ /**
423
+ * @brief Write error message to active log handler.
424
+ *
425
+ * The zone parser operates on a per-record base and therefore cannot detect
426
+ * errors that span records. e.g. SOA records being specified more than once.
427
+ * The user may print a message using the active log handler, keeping the
428
+ * error message format consistent.
429
+ *
430
+ * @param[in] parser Zone parser
431
+ * @param[in] category Log category
432
+ * @param[in] format Format string compatible with printf
433
+ * @param[in] ... Variadic arguments corresponding to #format
434
+ */
435
+ ZONE_EXPORT void zone_log (
436
+ zone_parser_t * parser ,
437
+ uint32_t category ,
438
+ const char * format ,
439
+ ...)
440
+ zone_nonnull ((1 ,3 ))
441
+ zone_format_printf (3 ,4 );
442
+
443
+ /**
444
+ * @brief Write error message to active log handler.
445
+ *
446
+ * @param[in] parser Zone parser
447
+ * @param[in] category Log category
448
+ * @param[in] format Format string compatible with printf
449
+ * @param[in] arguments Argument list
450
+ */
451
+ ZONE_EXPORT void zone_vlog (
452
+ zone_parser_t * parser ,
453
+ uint32_t category ,
454
+ const char * format ,
455
+ va_list arguments )
456
+ zone_nonnull ((1 ,3 ));
457
+
458
+ ZONE_EXPORT inline void
459
+ zone_nonnull ((1 ,2 ))
460
+ zone_format_printf (2 ,3 )
461
+ zone_error (zone_parser_t * parser , const char * format , ...)
462
+ {
463
+ if (!(parser -> options .log .categories & ZONE_ERROR ))
464
+ return ;
465
+ va_list arguments ;
466
+ va_start (arguments , format );
467
+ zone_vlog (parser , ZONE_ERROR , format , arguments );
468
+ va_end (arguments );
469
+ }
470
+
471
+ ZONE_EXPORT inline void
472
+ zone_nonnull ((1 ,2 ))
473
+ zone_format_printf (2 ,3 )
474
+ zone_warning (zone_parser_t * parser , const char * format , ...)
475
+ {
476
+ if (!(parser -> options .log .categories & ZONE_WARNING ))
477
+ return ;
478
+ va_list arguments ;
479
+ va_start (arguments , format );
480
+ zone_vlog (parser , ZONE_WARNING , format , arguments );
481
+ va_end (arguments );
482
+ }
483
+
484
+ ZONE_EXPORT inline void
485
+ zone_nonnull ((1 ,2 ))
486
+ zone_format_printf (2 ,3 )
487
+ zone_info (zone_parser_t * parser , const char * format , ...)
488
+ {
489
+ if (!(parser -> options .log .categories & ZONE_INFO ))
490
+ return ;
491
+ va_list arguments ;
492
+ va_start (arguments , format );
493
+ zone_vlog (parser , ZONE_INFO , format , arguments );
494
+ va_end (arguments );
495
+ }
496
+
497
+
443
498
#if defined(__cplusplus )
444
499
}
445
500
#endif
0 commit comments