libvisual  0.5.0
lv_log.h
1 /* Libvisual - The audio visualisation framework.
2  *
3  * Copyright (C) 2012 Libvisual team
4  * 2004-2006 Dennis Smit
5  *
6  * Authors: Chong Kai Xiong <kaixiong@codeleft.sg>
7  * Dennis Smit <ds@nerds-incorporated.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU Lesser General Public License as
11  * published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * This program 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
17  * GNU Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  */
23 
24 #ifndef _LV_LOG_H
25 #define _LV_LOG_H
26 
27 #include <libvisual/lvconfig.h>
28 #include <libvisual/lv_defines.h>
29 
35 LV_BEGIN_DECLS
36 
42 typedef enum {
51 
57 typedef struct {
58  const char *file;
59  const char *func;
60  unsigned int line;
61 } VisLogSource;
62 
73 typedef void (*VisLogHandlerFunc) (VisLogSeverity severity, const char *message,
74  const VisLogSource *source, void *user_data);
75 
81 LV_API void visual_log_set_verbosity (VisLogSeverity level);
82 
89 
97 LV_API void visual_log_set_handler (VisLogSeverity severity, VisLogHandlerFunc handler, void *user_data);
98 
106 #define visual_log(severity,...) \
107  _lv_log (severity, \
108  __FILE__, \
109  __LINE__, \
110  __PRETTY_FUNCTION__, \
111  __VA_ARGS__)
112 
113 LV_API void _lv_log (VisLogSeverity severity, const char *file, int line, const char *funcname,
114  const char *fmt, ...) LV_CHECK_PRINTF_FORMAT(5, 6);
115 
116 LV_END_DECLS
117 
122 #endif /* _LV_LOG_H */