our current experimental Neutrino branch

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@27 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Commit: bc5bd4154e
Author: mrcolor <mrcolor@e54a6e83-5905-42d5-8d5c-058d10e6a962>
Date: 2009-12-08 (Tue, 08 Dec 2009)
This commit is contained in:
mrcolor
2009-12-08 11:05:11 +00:00
commit cb8dd3394d
876 changed files with 193775 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
//=============================================================================
// YHTTPD
// Logging & Debugging
//=============================================================================
#ifndef __yhttpd_logging_h__
#define __yhttpd_logging_h__
// system
#include <pthread.h>
// yhttpd
#include "yconfig.h"
// forward declaration
class CWebserverConnection;
//-----------------------------------------------------------------------------
// Log Level
//-----------------------------------------------------------------------------
// 1 : Connection Information (called URL)
// 2 : Parameters??
// 3 : yParser Main Infos
// 5 : ycmd: Every yParser Loop Command expansion
// 6 : yresult: Every yParser Loop Command expansion
// 8 : Central Functions Detailed
// 9 : Socket Operations
//-----------------------------------------------------------------------------
class CLogging
{
protected:
pthread_mutex_t Log_mutex;
FILE *Logfile;
bool Debug;
bool LogToFile;
static CLogging *instance;
CLogging(void);
~CLogging(void);
public:
int LogLevel;
// Instance Handling
static CLogging *getInstance(void);
static void deleteInstance(void);
void setDebug(bool _debug);
bool getDebug(void);
// Logging
void printf(const char *fmt, ...);
};
//-----------------------------------------------------------------------------
// definitions for easy use
//-----------------------------------------------------------------------------
// print always
#define aprintf(fmt, args...) \
do { CLogging::getInstance()->printf("[yhttpd] " fmt, ## args); } while (0)
// print show file and linenumber
#define log_printfX(fmt, args...) \
do { CLogging::getInstance()->printf("[yhttpd(%s:%d)] " fmt, __FILE__, __LINE__, ## args); } while (0)
//Set Watch Point (show file and linenumber and function)
#define WP() \
do { CLogging::getInstance()->printf("[yhttpd(%s:%d)%s]\n", __FILE__, __LINE__, __FUNCTION__); } while (0)
// print if level matches
#define log_level_printf(level, fmt, args...) \
do { if(CLogging::getInstance()->LogLevel>=level) CLogging::getInstance()->printf("[yhttpd#%d] " fmt, level, ## args); } while (0)
// print if level matches / show file and linenumber
#define log_level_printfX(level, fmt, args...) \
do { if(CLogging::getInstance()->LogLevel>=level) CLogging::getInstance()->printf("[yhttpd#%d(%s:%d)] " fmt, level, __FILE__, __LINE__, ## args); } while (0)
// print only if debug is on
#define dprintf(fmt, args...) \
do { if(CLogging::getInstance()->getDebug())CLogging::getInstance()->printf("[yhttpd] " fmt, ## args); } while (0)
// print string to stdandard error
#define dperror(str) \
do { perror("[yhttpd] " str); } while (0)
#endif /* __yttpd_logging_h__ */