annotate src/debug.h @ 1802:956aab097ea7

added 2010 to copyright text
author nadvornik
date Tue, 16 Feb 2010 21:18:03 +0000
parents 8b89e3ff286b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
1 /*
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
2 * Geeqie
1802
956aab097ea7 added 2010 to copyright text
nadvornik
parents: 1284
diff changeset
3 * Copyright (C) 2008 - 2010 The Geeqie Team
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
4 *
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
5 * Authors: Vladimir Nadvornik, Laurent Monin
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
6 *
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
7 * This software is released under the GNU General Public License (GNU GPL).
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
8 * Please read the included file COPYING for more information.
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
9 * This software comes with no warranty of any kind, use at your own risk!
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
10 */
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
11
686
c0dda0ffb931 configure.in was rewritten:
bruclik
parents: 673
diff changeset
12 #ifndef _DEBUG_H
c0dda0ffb931 configure.in was rewritten:
bruclik
parents: 673
diff changeset
13 #define _DEBUG_H
c0dda0ffb931 configure.in was rewritten:
bruclik
parents: 673
diff changeset
14
c0dda0ffb931 configure.in was rewritten:
bruclik
parents: 673
diff changeset
15 #include <glib.h>
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
16
673
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 509
diff changeset
17 #define DOMAIN_DEBUG "debug"
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 509
diff changeset
18 #define DOMAIN_INFO "info"
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 509
diff changeset
19
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 686
diff changeset
20 gint log_domain_printf(const gchar *domain, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
673
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 509
diff changeset
21 #define log_printf(...) log_domain_printf(DOMAIN_INFO, __VA_ARGS__)
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 509
diff changeset
22
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
23 #ifdef DEBUG
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
24
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
25 #define DEBUG_LEVEL_MIN 0
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
26 #define DEBUG_LEVEL_MAX 4
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
27
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
28 gint get_debug_level(void);
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
29 void set_debug_level(gint new_level);
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
30 void debug_level_add(gint delta);
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
31 gint required_debug_level(gint level);
509
b78a91d0779e Move get_exec_time() to debug.{c,h}.
zas_
parents: 507
diff changeset
32 const gchar *get_exec_time(void);
b78a91d0779e Move get_exec_time() to debug.{c,h}.
zas_
parents: 507
diff changeset
33 void init_exec_time(void);
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
34
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
35 #define DEBUG_N(n, ...) do \
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
36 { \
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
37 gint debug_level = get_debug_level(); \
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
38 if (debug_level >= (n)) \
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
39 { \
673
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 509
diff changeset
40 if (debug_level != 1) log_domain_printf(DOMAIN_DEBUG, "%s:%d: ", __FILE__, __LINE__); \
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 509
diff changeset
41 log_domain_printf(DOMAIN_DEBUG, __VA_ARGS__); \
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 509
diff changeset
42 log_domain_printf(DOMAIN_DEBUG, "\n"); \
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
43 } \
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
44 } while (0)
509
b78a91d0779e Move get_exec_time() to debug.{c,h}.
zas_
parents: 507
diff changeset
45
b78a91d0779e Move get_exec_time() to debug.{c,h}.
zas_
parents: 507
diff changeset
46 #else /* DEBUG */
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
47
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
48 #define get_debug_level() (0)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
49 #define set_debug_level(new_level) do { } while(0)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
50 #define debug_level_add(delta) do { } while(0)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
51 #define required_debug_level(level) (0)
509
b78a91d0779e Move get_exec_time() to debug.{c,h}.
zas_
parents: 507
diff changeset
52 #define get_exec_time() ""
b78a91d0779e Move get_exec_time() to debug.{c,h}.
zas_
parents: 507
diff changeset
53 #define init_exec_time() do { } while(0)
b78a91d0779e Move get_exec_time() to debug.{c,h}.
zas_
parents: 507
diff changeset
54
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
55 #define DEBUG_N(n, ...) do { } while(0)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
56
509
b78a91d0779e Move get_exec_time() to debug.{c,h}.
zas_
parents: 507
diff changeset
57 #endif /* DEBUG */
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
58
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
59 #define DEBUG_0(...) DEBUG_N(0, __VA_ARGS__)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
60 #define DEBUG_1(...) DEBUG_N(1, __VA_ARGS__)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
61 #define DEBUG_2(...) DEBUG_N(2, __VA_ARGS__)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
62 #define DEBUG_3(...) DEBUG_N(3, __VA_ARGS__)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
63 #define DEBUG_4(...) DEBUG_N(4, __VA_ARGS__)
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
64
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents:
diff changeset
65
686
c0dda0ffb931 configure.in was rewritten:
bruclik
parents: 673
diff changeset
66 #endif /* _DEBUG_H */
1055
1646720364cf Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents: 1000
diff changeset
67 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */