File: debug.h

package info (click to toggle)
apt-cacher-ng 0.8.0-3
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,768 kB
  • ctags: 1,640
  • sloc: cpp: 14,741; ansic: 462; perl: 376; sh: 357; makefile: 88
file content (66 lines) | stat: -rwxr-xr-x 1,340 bytes parent folder | download | duplicates (4)
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

#ifndef __DEBUG_H__
#define __DEBUG_H__

#include "acfg.h"
#include "aclogger.h"
#include "meta.h"

#ifdef DEBUG
#include <assert.h>
#define ASSERT(x) assert(x)
#else
#define ASSERT(x)
#endif

#ifndef DEBUG
#define ldbgvl(v, x)
#define dbglvl(v)
#define ldbg(x)
#define dbgline
#define ASSERT(x)
#define LOG(x)
#define LOGSTART(x)
#define LOGSTARTs(x)
#define LOGSTART2(x,y)
#define LOGSTART2s(x,y)
#define DBGQLOG(x)
#define dbgprint(x)
inline void dump_proc_status(){}; // strip away

#else

#include <fstream>
#include <iostream>

#define LOGLVL(n, x) if(acfg::debug&n){ __logobj.GetFmter() << x; __logobj.Write(__FILE__,__LINE__); }
#define LOG(x) LOGLVL(LOG_DEBUG, x)

#define LOGSTART(x) t_logger __logobj(x, this);
#define LOGSTARTs(x) t_logger __logobj(x, NULL);
#define LOGSTART2(x, y) t_logger __logobj(x, this); LOGLVL(LOG_DEBUG, y /* << "@" __FILE__ ":" << __LINE__  */ )
#define LOGSTART2s(x, y) t_logger __logobj(x, NULL); LOGLVL(LOG_DEBUG, y /*<< "@" __FILE__ ":" << __LINE__ */ )

#define dbgprint(x) std::cerr << x << std::endl;

#define ldbg(x) LOG(x)

#define dbgline ldbg("mark")
#define DBGQLOG(x) {aclog::err(tSS()<< x);}


inline void dump_proc_status()
{
	using namespace std;
	ifstream sf("/proc/self/status");
	while (sf)
	{
		string s;
		getline(sf, s);
		cerr << s << endl;
	}
};

#endif

#endif // __DEBUG_H__