/* * The Rin Library – diagnostics module * * Copyright (C) 2015-2019 Gediminas Jakutis * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; version 2.1 * of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef LIBRIN_DIAGNOSTIC_INCLUDED #define LIBRIN_DIAGNOSTIC_INCLUDED #include "rin/definitions.h" #include #define RIN_DIAG_SET 1 #define RIN_DIAG_UNSET 0 #define RIN_DIAG_PREFIX (1 << 0) #define RIN_DIAG_TIME (1 << 1) #define RIN_DIAG_FUNC (1 << 2) #define RIN_DIAG_THREADNUM (1 << 3) #define RIN_DIAG_ALLFLAGS ( RIN_DIAG_PREFIX | \ RIN_DIAG_TIME | \ RIN_DIAG_FUNC | \ RIN_DIAG_THREADNUM) enum rin_diag_outstream { rin_diag_err, rin_diag_warn, rin_diag_fixme, rin_diag_info }; void rin_diag_init(void); int rin_diag_flags(int flag, int action); int rin_diag_set_outstream(enum rin_diag_outstream channel, FILE *stream); void __rin_err(const char *func_name, const char *format, ...) FORMAT_STRING(2, 3); void __rin_warn(const char *func_name, const char *format, ...) FORMAT_STRING(2, 3); void __rin_fixme(const char *func_name, const char *format, ...) FORMAT_STRING(2, 3); void __rin_info(const char *func_name, const char *format, ...) FORMAT_STRING(2, 3); #define rin_err(a,...) do {__rin_err(__func__, a __VA_OPT__(,) __VA_ARGS__); } while (0) #define rin_warn(a,...) do {__rin_warn(__func__, a __VA_OPT__(,) __VA_ARGS__); } while (0) #define rin_fixme(a,...) do {__rin_fixme(__func__, a __VA_OPT__(,) __VA_ARGS__); } while (0) #define rin_info(a,...) do {__rin_info(__func__, a __VA_OPT__(,) __VA_ARGS__); } while (0) #endif /* LIBRIN_DIAGNOSTIC_INCLUDED */