1 /*
2  *  Copyright (C) 2008-2009 Andrej Stepanchuk
3  *  Copyright (C) 2009-2010 Howard Chu
4  *
5  *  This file is part of librtmp.
6  *
7  *  librtmp is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU Lesser General Public License as
9  *  published by the Free Software Foundation; either version 2.1,
10  *  or (at your option) any later version.
11  *
12  *  librtmp is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU Lesser General Public License
18  *  along with librtmp see the file COPYING.  If not, write to
19  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  *  Boston, MA  02110-1301, USA.
21  *  http://www.gnu.org/copyleft/lgpl.html
22  */
23 
24 #ifndef __RTMP_LOG_H__
25 #define __RTMP_LOG_H__
26 
27 #include <stdio.h>
28 #include <stdarg.h>
29 #include <stdint.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 /* Enable this to get full debugging output */
35 /* #define _DEBUG */
36 
37 #ifdef _DEBUG
38 #undef NODEBUG
39 #endif
40 
41 typedef enum
42 { RTMP_LOGCRIT=0, RTMP_LOGERROR, RTMP_LOGWARNING, RTMP_LOGINFO,
43   RTMP_LOGDEBUG, RTMP_LOGDEBUG2, RTMP_LOGALL
44 } RTMP_LogLevel;
45 
46 extern RTMP_LogLevel RTMP_debuglevel;
47 
48 typedef void (RTMP_LogCallback)(int level, const char *fmt, va_list);
49 void RTMP_LogSetCallback(RTMP_LogCallback *cb);
50 void RTMP_LogSetOutput(FILE *file);
51 #ifdef __GNUC__
52 void RTMP_LogPrintf(const char *format, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
53 void RTMP_LogStatus(const char *format, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
54 void RTMP_Log(int level, const char *format, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
55 #else
56 void RTMP_LogPrintf(const char *format, ...);
57 void RTMP_LogStatus(const char *format, ...);
58 void RTMP_Log(int level, const char *format, ...);
59 #endif
60 void RTMP_LogHex(int level, const uint8_t *data, unsigned long len);
61 void RTMP_LogHexString(int level, const uint8_t *data, unsigned long len);
62 void RTMP_LogSetLevel(RTMP_LogLevel lvl);
63 RTMP_LogLevel RTMP_LogGetLevel(void);
64 
65 #ifdef __cplusplus
66 }
67 #endif
68 
69 #endif
70