Debian Codegraph @

online-accounts-common/debug.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2013 Canonical Ltd.
3 *
4 * Contact: Alberto Mardegan <[email protected]>
5 *
6 * This file is part of lomiri-online-accounts-ui and lomiri-online-accounts-
7 * service
8 *
9 * This program is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 3, as published
11 * by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranties of
15 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
16 * PURPOSE. See the GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21 #ifndef OAU_DEBUG_H
22 #define OAU_DEBUG_H
23
24 #include <QDebug>
25
26 /* 0 - fatal, 1 - critical(default), 2 - info/debug */
27 extern int appLoggingLevel;
28
29 static inline bool debugEnabled()
30 {
31 return appLoggingLevel >= 2;
32 }
33
34 static inline int loggingLevel()
35 {
36 return appLoggingLevel;
37 }
38
39 void setLoggingLevel(int level);
40
41 #ifdef DEBUG_ENABLED
42 #define DEBUG() \
43 if (debugEnabled()) qDebug() << __FILE__ << __LINE__ << __func__
44 #else
45 #define DEBUG() while (0) qDebug()
46 #endif
47
48 #endif // OAU_DEBUG_H