31 lines
		
	
	
		
			791 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			791 B
		
	
	
	
		
			C++
		
	
	
	
	
	
/*
 | 
						|
 *  log4cpp.h
 | 
						|
 *
 | 
						|
 *  Created by Bob Polis on 05-07-2007.
 | 
						|
 *  Copyright 2007 Thalictrum. All rights reserved.
 | 
						|
 */
 | 
						|
 | 
						|
#ifndef __log4cpp__
 | 
						|
#define __log4cpp__
 | 
						|
 | 
						|
#include <sstream>
 | 
						|
#include <pthread.h>
 | 
						|
 | 
						|
extern std::stringstream glog; // WARNING: *not* thread-safe!
 | 
						|
 | 
						|
void print_timestamp();
 | 
						|
void __slog(const char* func, const char* file, int line, std::stringstream& ss);
 | 
						|
void _dlog(const char* func, const char* file, int line, const char* fmt, ...);
 | 
						|
 | 
						|
#if DEBUG
 | 
						|
	#define _slog(ss) __slog(__FUNCTION__, __FILE__, __LINE__, (std::stringstream&)(ss));
 | 
						|
	#define dlog(fmt, ...) _dlog(__FUNCTION__, __FILE__, __LINE__, fmt, __VA_ARGS__);
 | 
						|
#else
 | 
						|
	#define _slog(ss)
 | 
						|
	#define dlog(fmt, ...)
 | 
						|
#endif
 | 
						|
 | 
						|
#define sclog(fmt, ...) _dlog(__FUNCTION__, __FILE__, __LINE__, fmt, __VA_ARGS__);
 | 
						|
 | 
						|
#endif //__log4cpp__
 |