1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
/*! \file muggle_tools.h
* \brief A few utility functions for standalone and plugin messaging for the vdr muggle plugindatabase
*
* \version $Revision: 1.4 $
* \date $Date: 2004/08/30 14:31:43 $
* \author Ralf Klueber, Lars von Wedel, Andreas Kellner
* \author file owner: $Author: LarsAC $
*
*/
/* makes sure we don't use the same declarations twice */
#ifndef _MUGGLE_TOOLS_H
#define _MUGGLE_TOOLS_H
#include <iostream>
#include <string>
#include <mysql/mysql.h>
#define STANDALONE 1 // what's this?
// mySql helper functions
MYSQL_RES* mgSqlReadQuery( MYSQL *db, const char *fmt, ... );
void mgSqlWriteQuery( MYSQL *db, const char *fmt, ... );
// Messaging functions
void mgSetDebugLevel(int new_level);
void mgDebug(int level, const char *fmt, ...);
void mgDebug( const char *fmt, ... );
void mgWarning(const char *fmt, ...);
void mgError(const char *fmt, ...);
#ifdef DEBUG
#define MGLOG(x) mgLog __thelog(x)
#else
#define MGLOG(x) {}
#endif
#ifdef DEBUG
#define MGLOGSTREAM __thelog.getStream()
#else
#define MGLOGSTREAM __thelog.getStream()
#endif
class mgLog
{
public:
enum
{
LOG, WARNING, ERROR, FATAL
} mgLogLevel;
std::ostream& getStream()
{
return std::cout;
}
mgLog( std::string methodname ) : m_methodname( methodname )
{
getStream() << m_methodname << " entered" << std::endl;
};
~mgLog()
{
getStream() << m_methodname << " terminated" << std::endl;
}
private:
std::string m_methodname;
};
/* -------------------- begin CVS log ---------------------------------
* $Log: mg_tools.h,v $
* Revision 1.4 2004/08/30 14:31:43 LarsAC
* Documentation added
*
* Revision 1.3 2004/05/28 15:29:18 lvw
* Merged player branch back on HEAD branch.
*
* Revision 1.2.2.2 2004/04/18 14:08:41 lvw
* Added some more logging/debugging code
*
* Revision 1.2.2.1 2004/04/09 16:14:48 lvw
* Added further code for logging/debugging.
*
* Revision 1.2 2004/02/02 22:48:04 MountainMan
* added CVS $Log
*
*
* --------------------- end CVS log ----------------------------------
*/
#endif /* _MUGGLE_TOOLS_H */
|