|
a/libupnpp/log.hxx |
|
b/libupnpp/log.hxx |
|
... |
|
... |
19 |
|
19 |
|
20 |
#include <iostream>
|
20 |
#include <iostream>
|
21 |
#include <fstream>
|
21 |
#include <fstream>
|
22 |
#include <string>
|
22 |
#include <string>
|
23 |
|
23 |
|
24 |
namespace upnppdebug {
|
24 |
namespace UPnPP {
|
25 |
|
25 |
|
26 |
class Logger {
|
26 |
class Logger {
|
27 |
public:
|
27 |
public:
|
28 |
static Logger *getTheLog(const std::string& fn);
|
28 |
static Logger *getTheLog(const std::string& fn);
|
29 |
std::ostream& getstream() {
|
29 |
std::ostream& getstream() {
|
|
... |
|
... |
45 |
Logger(const std::string& fn);
|
45 |
Logger(const std::string& fn);
|
46 |
Logger(const Logger &);
|
46 |
Logger(const Logger &);
|
47 |
Logger& operator=(const Logger &);
|
47 |
Logger& operator=(const Logger &);
|
48 |
};
|
48 |
};
|
49 |
|
49 |
|
50 |
}
|
|
|
51 |
|
|
|
52 |
#define DEBOUT (upnppdebug::Logger::getTheLog("")->getstream())
|
50 |
#define DEBOUT (Logger::getTheLog("")->getstream())
|
53 |
#define LOCAL_LOGINC 0
|
51 |
#define LOCAL_LOGINC 0
|
54 |
#define LOGLEVEL (upnppdebug::Logger::getTheLog("")->getloglevel()+LOCAL_LOGINC)
|
52 |
#define LOGLEVEL (Logger::getTheLog("")->getloglevel()+LOCAL_LOGINC)
|
55 |
|
53 |
|
56 |
#define LOGDEB1(X) { \
|
54 |
#define LOGDEB1(X) { \
|
57 |
if (LOGLEVEL >= upnppdebug::Logger::LLDEB1) \
|
55 |
if (LOGLEVEL >= Logger::LLDEB1) \
|
58 |
{ \
|
56 |
{ \
|
59 |
DEBOUT << __FILE__ << ":" << __LINE__<< "::"; DEBOUT << X; \
|
57 |
DEBOUT << __FILE__ << ":" << __LINE__<< "::"; DEBOUT << X; \
|
60 |
} \
|
58 |
} \
|
61 |
}
|
59 |
}
|
62 |
|
60 |
|
63 |
#define LOGDEB(X) { \
|
61 |
#define LOGDEB(X) { \
|
64 |
if (LOGLEVEL >= upnppdebug::Logger::LLDEB) \
|
62 |
if (LOGLEVEL >= Logger::LLDEB) \
|
65 |
{ \
|
63 |
{ \
|
66 |
DEBOUT << __FILE__ << ":" << __LINE__<< "::"; DEBOUT << X; \
|
64 |
DEBOUT << __FILE__ << ":" << __LINE__<< "::"; DEBOUT << X; \
|
67 |
} \
|
65 |
} \
|
68 |
}
|
66 |
}
|
69 |
|
67 |
|
70 |
#define LOGINF(X) { \
|
68 |
#define LOGINF(X) { \
|
71 |
if (LOGLEVEL >= upnppdebug::Logger::LLINF) \
|
69 |
if (LOGLEVEL >= Logger::LLINF) \
|
72 |
{ \
|
70 |
{ \
|
73 |
DEBOUT << __FILE__ << ":" << __LINE__<< "::"; DEBOUT << X; \
|
71 |
DEBOUT << __FILE__ << ":" << __LINE__<< "::"; DEBOUT << X; \
|
74 |
} \
|
72 |
} \
|
75 |
}
|
73 |
}
|
76 |
|
74 |
|
77 |
#define LOGERR(X) { \
|
75 |
#define LOGERR(X) { \
|
78 |
if (LOGLEVEL >= upnppdebug::Logger::LLERR) \
|
76 |
if (LOGLEVEL >= Logger::LLERR) \
|
79 |
{ \
|
77 |
{ \
|
80 |
DEBOUT << __FILE__ << ":" << __LINE__<< "::"; DEBOUT << X; \
|
78 |
DEBOUT << __FILE__ << ":" << __LINE__<< "::"; DEBOUT << X; \
|
81 |
} \
|
79 |
} \
|
82 |
}
|
80 |
}
|
83 |
|
81 |
|
84 |
#define LOGFAT(X) { \
|
82 |
#define LOGFAT(X) { \
|
85 |
if (LOGLEVEL >= upnppdebug::Logger::LLFAT) \
|
83 |
if (LOGLEVEL >= Logger::LLFAT) \
|
86 |
{ \
|
84 |
{ \
|
87 |
DEBOUT << __FILE__ << ":" << __LINE__<< "::"; DEBOUT << X; \
|
85 |
DEBOUT << __FILE__ << ":" << __LINE__<< "::"; DEBOUT << X; \
|
88 |
} \
|
86 |
} \
|
89 |
}
|
87 |
}
|
90 |
|
88 |
|
|
|
89 |
} // namespace UPnPP
|
|
|
90 |
|
91 |
|
91 |
|
92 |
#endif /* _LOG_H_X_INCLUDED_ */
|
92 |
#endif /* _LOG_H_X_INCLUDED_ */
|