Mercurial > geeqie
annotate src/debug.h @ 1768:a22c42d36e2e
German translation update
| author | mow |
|---|---|
| date | Tue, 13 Oct 2009 21:49:42 +0000 |
| parents | 8b89e3ff286b |
| children | 956aab097ea7 |
| rev | line source |
|---|---|
| 507 | 1 /* |
| 2 * Geeqie | |
| 1284 | 3 * Copyright (C) 2008 - 2009 The Geeqie Team |
| 507 | 4 * |
| 5 * Authors: Vladimir Nadvornik, Laurent Monin | |
| 6 * | |
| 7 * This software is released under the GNU General Public License (GNU GPL). | |
| 8 * Please read the included file COPYING for more information. | |
| 9 * This software comes with no warranty of any kind, use at your own risk! | |
| 10 */ | |
| 11 | |
| 686 | 12 #ifndef _DEBUG_H |
| 13 #define _DEBUG_H | |
| 14 | |
| 15 #include <glib.h> | |
| 507 | 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 | 23 #ifdef DEBUG |
| 24 | |
| 25 #define DEBUG_LEVEL_MIN 0 | |
| 26 #define DEBUG_LEVEL_MAX 4 | |
| 27 | |
| 28 gint get_debug_level(void); | |
| 29 void set_debug_level(gint new_level); | |
| 30 void debug_level_add(gint delta); | |
| 31 gint required_debug_level(gint level); | |
| 509 | 32 const gchar *get_exec_time(void); |
| 33 void init_exec_time(void); | |
| 507 | 34 |
| 35 #define DEBUG_N(n, ...) do \ | |
| 36 { \ | |
| 37 gint debug_level = get_debug_level(); \ | |
| 38 if (debug_level >= (n)) \ | |
| 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 | 43 } \ |
| 44 } while (0) | |
| 509 | 45 |
| 46 #else /* DEBUG */ | |
| 507 | 47 |
| 48 #define get_debug_level() (0) | |
| 49 #define set_debug_level(new_level) do { } while(0) | |
| 50 #define debug_level_add(delta) do { } while(0) | |
| 51 #define required_debug_level(level) (0) | |
| 509 | 52 #define get_exec_time() "" |
| 53 #define init_exec_time() do { } while(0) | |
| 54 | |
| 507 | 55 #define DEBUG_N(n, ...) do { } while(0) |
| 56 | |
| 509 | 57 #endif /* DEBUG */ |
| 507 | 58 |
| 59 #define DEBUG_0(...) DEBUG_N(0, __VA_ARGS__) | |
| 60 #define DEBUG_1(...) DEBUG_N(1, __VA_ARGS__) | |
| 61 #define DEBUG_2(...) DEBUG_N(2, __VA_ARGS__) | |
| 62 #define DEBUG_3(...) DEBUG_N(3, __VA_ARGS__) | |
| 63 #define DEBUG_4(...) DEBUG_N(4, __VA_ARGS__) | |
| 64 | |
| 65 | |
| 686 | 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: */ |
