1
/* GIMP - The GNU Image Manipulation Program
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
#ifndef __GIMP_LOG_H__
20
#define __GIMP_LOG_H__
25
GIMP_LOG_TOOL_EVENTS = 1 << 0,
26
GIMP_LOG_TOOL_FOCUS = 1 << 1,
27
GIMP_LOG_DND = 1 << 2,
28
GIMP_LOG_HELP = 1 << 3,
29
GIMP_LOG_DIALOG_FACTORY = 1 << 4,
30
GIMP_LOG_MENUS = 1 << 5,
31
GIMP_LOG_SAVE_DIALOG = 1 << 6,
32
GIMP_LOG_IMAGE_SCALE = 1 << 7,
33
GIMP_LOG_SHADOW_TILES = 1 << 8,
34
GIMP_LOG_SCALE = 1 << 9
38
extern GimpLogFlags gimp_log_flags;
41
void gimp_log_init (void);
42
void gimp_log (const gchar *function,
46
...) G_GNUC_PRINTF (4, 5);
47
void gimp_logv (const gchar *function,
54
#ifdef G_HAVE_ISO_VARARGS
56
#define GIMP_LOG(type, ...) \
58
if (gimp_log_flags & GIMP_LOG_##type) \
59
gimp_log (G_STRFUNC, __LINE__, #type, __VA_ARGS__); \
62
#elif defined(G_HAVE_GNUC_VARARGS)
64
#define GIMP_LOG(type, format...) \
66
if (gimp_log_flags & GIMP_LOG_##type) \
67
gimp_log (G_STRFUNC, __LINE__, #type, format); \
70
#else /* no varargs macros */
72
/* need to expand all the short forms
73
* to make them known constants at compile time
75
#define TOOL_EVENTS GIMP_LOG_TOOL_EVENTS
76
#define TOOL_FOCUS GIMP_LOG_TOOL_FOCUS
77
#define DND GIMP_LOG_DND
78
#define HELP GIMP_LOG_HELP
79
#define DIALOG_FACTORY GIMP_LOG_DIALOG_FACTORY
80
#define MENUS GIMP_LOG_MENUS
81
#define SAVE_DIALOG GIMP_LOG_SAVE_DIALOG
82
#define IMAGE_SCALE GIMP_LOG_IMAGE_SCALE
83
#define SHADOW_TILES GIMP_LOG_SHADOW_TILES
84
#define SCALE GIMP_LOG_SCALE
86
#if 0 /* last resort */
87
# define GIMP_LOG /* nothing => no varargs, no log */
91
GIMP_LOG (GimpLogFlags flags,
96
va_start (args, format);
97
if (gimp_log_flags & flags)
98
gimp_logv ("", 0, "", format, args);
102
#endif /* !__GNUC__ */
104
#endif /* __GIMP_LOG_H__ */