Merge ../mlt
[melted] / src / framework / mlt_log.h
1 /**
2 * \file mlt_log.h
3 * \brief logging functions
4 *
5 * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
6 *
7 * This file was a part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24 #ifndef MLT_LOG_H
25 #define MLT_LOG_H
26
27 #include <stdarg.h>
28
29 #define MLT_LOG_QUIET -8
30
31 /**
32 * something went really wrong and we will crash now
33 */
34 #define MLT_LOG_PANIC 0
35
36 /**
37 * something went wrong and recovery is not possible
38 * like no header in a format which depends on it or a combination
39 * of parameters which are not allowed
40 */
41 #define MLT_LOG_FATAL 8
42
43 /**
44 * something went wrong and cannot losslessly be recovered
45 * but not all future data is affected
46 */
47 #define MLT_LOG_ERROR 16
48
49 /**
50 * something somehow does not look correct / something which may or may not
51 * lead to some problems
52 */
53 #define MLT_LOG_WARNING 24
54
55 #define MLT_LOG_INFO 32
56 #define MLT_LOG_VERBOSE 40
57
58 /**
59 * stuff which is only useful for MLT developers
60 */
61 #define MLT_LOG_DEBUG 48
62
63 /**
64 * Send the specified message to the log if the level is less than or equal to
65 * the current logging level. By default, all logging messages are sent to
66 * stderr. This behavior can be altered by setting a different mlt_vlog callback
67 * function.
68 *
69 * \param service An optional pointer to a \p mlt_service_s.
70 * \param level The importance level of the message, lower values signifying
71 * higher importance.
72 * \param fmt The format string (printf-compatible) that specifies how
73 * subsequent arguments are converted to output.
74 * \see mlt_vlog
75 */
76 #ifdef __GNUC__
77 void mlt_log( void *service, int level, const char *fmt, ... ) __attribute__ ((__format__ (__printf__, 3, 4)));
78 #else
79 void mlt_log( void *service, int level, const char *fmt, ... );
80 #endif
81
82 #define mlt_log_panic(service, format, args...) mlt_log((service), MLT_LOG_PANIC, (format), ## args)
83 #define mlt_log_fatal(service, format, args...) mlt_log((service), MLT_LOG_FATAL, (format), ## args)
84 #define mlt_log_error(service, format, args...) mlt_log((service), MLT_LOG_ERROR, (format), ## args)
85 #define mlt_log_warning(service, format, args...) mlt_log((service), MLT_LOG_WARNING, (format), ## args)
86 #define mlt_log_info(service, format, args...) mlt_log((service), MLT_LOG_INFO, (format), ## args)
87 #define mlt_log_verbose(service, format, args...) mlt_log((service), MLT_LOG_VERBOSE, (format), ## args)
88 #define mlt_log_debug(service, format, args...) mlt_log((service), MLT_LOG_DEBUG, (format), ## args)
89
90 void mlt_vlog( void *service, int level, const char *fmt, va_list );
91 int mlt_log_get_level( void );
92 void mlt_log_set_level( int );
93 void mlt_log_set_callback( void (*)( void*, int, const char*, va_list ) );
94
95 #endif /* MLT_LOG_H */