1 /* GNU Mailutils -- a suite of utilities for electronic mail 2 Copyright (C) 1999-2021 Free Software Foundation, Inc. 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 3 of the License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General 15 Public License along with this library. If not, see 16 <http://www.gnu.org/licenses/>. */ 17 18 #ifndef _MAILUTILS_DIAG_H 19 #define _MAILUTILS_DIAG_H 20 21 #include <stdarg.h> 22 23 #include <mailutils/types.h> 24 #include <mailutils/log.h> 25 #include <mailutils/debug.h> 26 #include <mailutils/locus.h> 27 28 #ifdef __cplusplus 29 extern "C" { 30 #endif 31 32 extern char *mu_program_name; 33 extern char *mu_full_program_name; 34 35 #define MU_DIAG_EMERG MU_LOG_EMERG 36 #define MU_DIAG_ALERT MU_LOG_ALERT 37 #define MU_DIAG_CRIT MU_LOG_CRIT 38 #define MU_DIAG_ERROR MU_LOG_ERROR 39 #define MU_DIAG_ERR MU_DIAG_ERROR 40 #define MU_DIAG_WARNING MU_LOG_WARNING 41 #define MU_DIAG_NOTICE MU_LOG_NOTICE 42 #define MU_DIAG_INFO MU_LOG_INFO 43 #define MU_DIAG_DEBUG MU_LOG_DEBUG 44 45 void mu_set_program_name (const char *); 46 void mu_diag_init (void); 47 void mu_diag_vprintf (int, const char *, va_list); 48 void mu_diag_cont_vprintf (const char *, va_list); 49 void mu_diag_printf (int, const char *, ...) MU_PRINTFLIKE(2,3); 50 void mu_diag_cont_printf (const char *fmt, ...) MU_PRINTFLIKE(1,2); 51 52 void mu_diag_voutput (int, const char *, va_list); 53 void mu_diag_output (int, const char *, ...) MU_PRINTFLIKE(2,3); 54 void mu_vdiag_at_locus_range (int level, struct mu_locus_range const *loc, 55 const char *fmt, va_list ap); 56 void mu_diag_at_locus_point (int level, struct mu_locus_point const *loc, 57 const char *fmt, ...); 58 void mu_diag_at_locus_range (int level, struct mu_locus_range const *loc, 59 const char *fmt, ...); 60 61 int mu_diag_level_to_syslog (int level); 62 const char *mu_diag_level_to_string (int level); 63 64 void mu_diag_funcall (int level, const char *func, 65 const char *arg, int err); 66 67 #ifdef __cplusplus 68 } 69 #endif 70 71 #endif 72