add dbus command to allow checking of wether hardware is currently exported
[a2jmidid.git] / log.h
blob43f6df08c43d96ec67e85578f99bf4d07a66f1ac
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*
3 * ALSA SEQ < - > JACK MIDI bridge
5 * Copyright (c) 2008,2009 Nedko Arnaudov <nedko@arnaudov.name>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef LOG_H__76222A51_98D8_40C2_A67E_0FF38615A1DD__INCLUDED
22 #define LOG_H__76222A51_98D8_40C2_A67E_0FF38615A1DD__INCLUDED
24 #define ANSI_BOLD_ON "\033[1m"
25 #define ANSI_BOLD_OFF "\033[22m"
26 #define ANSI_COLOR_RED "\033[31m"
27 #define ANSI_COLOR_YELLOW "\033[33m"
28 #define ANSI_RESET "\033[0m"
30 #define A2J_LOG_LEVEL_INFO 1
31 #define A2J_LOG_LEVEL_ERROR 2
32 #define A2J_LOG_LEVEL_DEBUG 3
34 void
35 a2j_log(
36 unsigned int level,
37 const char * format,
38 ...);
40 #if defined(DEBUG)
41 # define a2j_debug(format, args...) a2j_log(A2J_LOG_LEVEL_DEBUG, "%s: " format "\n", __func__, ## args)
42 #else
43 # define a2j_debug(format, args...)
44 #endif /* DEBUG */
46 #define a2j_info(format, args...) a2j_log(A2J_LOG_LEVEL_INFO, format "\n", ## args)
47 #define a2j_error(format, args...) a2j_log(A2J_LOG_LEVEL_ERROR, ANSI_COLOR_RED "ERROR: " ANSI_RESET "%s: " format "\n", __func__, ## args)
48 #define a2j_warning(format, args...) a2j_log(A2J_LOG_LEVEL_ERROR, ANSI_COLOR_YELLOW "WARNING: " ANSI_RESET format "\n", ## args)
50 bool
51 a2j_log_init(
52 bool use_logfile);
54 void
55 a2j_log_uninit();
57 #endif /* #ifndef LOG_H__76222A51_98D8_40C2_A67E_0FF38615A1DD__INCLUDED */