2 * Copyright (C) 2003-2006 David Schleef <ds@schleef.org>
3 * 2005-2006 Eric Anholt <eric@anholt.net>
4 * 2006-2007 Benjamin Otte <otte@gnome.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301 USA
27 #include "swfdec_debug.h"
29 static const char *swfdec_debug_level_names
[] = {
39 #ifndef SWFDEC_LEVEL_DEFAULT
40 # define SWFDEC_LEVEL_DEFAULT SWFDEC_LEVEL_FIXME
43 static guint swfdec_debug_level
= SWFDEC_LEVEL_DEFAULT
;
46 swfdec_debug_log (guint level
, const char *file
, const char *function
,
47 int line
, const char *format
, ...)
52 if (level
> swfdec_debug_level
)
55 va_start (varargs
, format
);
56 s
= g_strdup_vprintf (format
, varargs
);
59 g_printerr ("SWFDEC: %s: %s(%d): %s: %s\n",
60 swfdec_debug_level_names
[level
], file
, line
, function
, s
);
65 swfdec_debug_set_level (guint level
)
67 if (swfdec_debug_level
>= G_N_ELEMENTS (swfdec_debug_level_names
))
68 swfdec_debug_level
= G_N_ELEMENTS (swfdec_debug_level_names
) - 1;
70 swfdec_debug_level
= level
;
74 swfdec_debug_get_level (void)
76 return swfdec_debug_level
;