~laney/ubuntu-system-settings/battery-charge-graph

« back to all changes in this revision

Viewing changes to lib/SystemSettings/debug.h

  • Committer: Alberto Mardegan
  • Date: 2013-05-08 08:55:54 UTC
  • Revision ID: alberto.mardegan@canonical.com-20130508085554-jjcanw47dt26e5li
Change directory structure: add libSystemSettings

Show diffs side-by-side

added added

removed removed

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