mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-02 18:31:12 +02:00
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:
86
src/nhttpd/yhttpd_core/ylogging.h
Normal file
86
src/nhttpd/yhttpd_core/ylogging.h
Normal 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__ */
|
Reference in New Issue
Block a user