File: log.h

package info (click to toggle)
gmidimonitor 3.6%2Bdfsg0-3
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 844 kB
  • ctags: 1,501
  • sloc: python: 10,956; ansic: 3,241; makefile: 18
file content (88 lines) | stat: -rw-r--r-- 2,838 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* -*- Mode: C ; c-basic-offset: 2 -*- */
/*****************************************************************************
 *
 *   This file is part of gmidimonitor
 *
 *   Copyright (C) 2006,2007,2008,2011 Nedko Arnaudov <nedko@arnaudov.name>
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; version 2 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 General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 *****************************************************************************/

#ifndef LOG_H__7097F6FE_4FEE_4962_9542_60375961F567__INCLUDED
#define LOG_H__7097F6FE_4FEE_4962_9542_60375961F567__INCLUDED

void log_msg(int level, const char * format, ...);

#define LOG_LEVEL_DEBUG      0
#define LOG_LEVEL_INFO       1
#define LOG_LEVEL_WARNING    2
#define LOG_LEVEL_NOTICE     3
#define LOG_LEVEL_ERROR      4
#define LOG_LEVEL_FATAL      5
#define LOG_LEVEL_BLACK_HOLE 6      

#if !defined(LOG_LEVEL)
#define LOG_LEVEL LOG_LEVEL_WARNING
#endif

#if LOG_LEVEL <= LOG_LEVEL_DEBUG
# define LOG_DEBUG(format, arg...)              \
  log_msg(LOG_LEVEL_DEBUG,                      \
          format "\n", ## arg)
#else
# define LOG_DEBUG(format, arg...)
#endif

#if LOG_LEVEL <= LOG_LEVEL_INFO
# define LOG_INFO(format, arg...)               \
  log_msg(LOG_LEVEL_INFO,                       \
          format "\n", ## arg)
#else
# define LOG_INFO(format, arg...)
#endif

#if LOG_LEVEL <= LOG_LEVEL_WARNING
# define LOG_WARNING(format, arg...)            \
  log_msg(LOG_LEVEL_WARNING,                    \
          format "\n", ## arg)
#else
# define LOG_WARNING(format, arg...)
#endif

#if LOG_LEVEL <= LOG_LEVEL_NOTICE
# define LOG_NOTICE(format, arg...)             \
  log_msg(LOG_LEVEL_NOTICE,                     \
          format "\n", ## arg)
#else
# define LOG_NOTICE(format, arg...)
#endif

#if LOG_LEVEL <= LOG_LEVEL_ERROR
# define LOG_ERROR(format, arg...)              \
  log_msg(LOG_LEVEL_ERROR,                      \
          format "\n", ## arg)
#else
# define LOG_ERROR(format, arg...)
#endif

#if LOG_LEVEL <= LOG_LEVEL_FATAL
# define LOG_FATAL(format, arg...)              \
  log_msg(LOG_LEVEL_FATAL,                      \
          format "\n", ## arg)
#else
# define LOG_FATAL(format, arg...)
#endif

#endif /* #ifndef LOG_H__7097F6FE_4FEE_4962_9542_60375961F567__INCLUDED */