summaryrefslogtreecommitdiff
path: root/src/libinotify/inotify-log.h
blob: fded18392c71f451d655a6022390101e4892a2e5 (plain)
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
/*
 * inotify-log.h - internal libinotify logging/debugging functions
 * Copyright © 2005 Ryan Lortie <desrt@desrt.ca>
 *
 *   This library is free software; you can redistribute it and/or
 *   modify it under the terms of version 2.1 of the GNU Lesser General
 *   Public as published by the Free Software Foundation.
 *
 *   This library 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 Street, Fifth Floor, Boston, MA 02110
 *
 *   $Id: inotify-log.h 17 2005-09-15 01:22:30Z ryanl $
 */

#ifndef _libinotify_inotify_log_h_
#define _libinotify_inotify_log_h_

#include <stdlib.h>
#include <glib.h>

#include "config.h"

#ifdef LIBINOTIFY_DEBUG
# define inotify_debug(x, ...) g_log("libinotify", G_LOG_LEVEL_DEBUG, \
				     x, ## __VA_ARGS__)
#else
# define inotify_debug(x, ...) 0
#endif

#define inotify_warn(x, ...) g_log("libinotify", G_LOG_LEVEL_WARNING, \
				   x, ## __VA_ARGS__)

#define inotify_fatal(x, ...) g_log("libinotify", G_LOG_LEVEL_ERROR, \
				    x, ## __VA_ARGS__)

static inline void
inotify_debug_initialise()
{
#ifdef LIBINOTIFY_DEBUG
  if( getenv( "DEBUG_LIBINOTIFY" ) == NULL )
    g_log_set_handler( "libinotify", G_LOG_LEVEL_DEBUG,
		       (GLogFunc) strlen, NULL );
#endif
}

#endif /* _libinotify_inotify_log_h_ */