
#ifndef _TRACE_H_
#define _TRACE_H_

int sx_trace(int level, char* file, char* func, int line, char* format,...);

#define SX_TRACE(a,format,b...) sx_trace(a,__FILE__,__FUNCTION__,__LINE__,format, ## b);

#define SX_TRACE_ERR 1
#define SX_TRACE_WARN 2
#define SX_TRACE_NOTICE 3
#define SX_TRACE_TRACE 4

#define SX_TRACE_ERROR SX_TRACE_ERR
#define SX_TRACE_WARNING SX_TRACE_WARN

#define SX_WARN(a) sx_trace(SX_TRACE_WARNING,__FILE__,__LINE__,a);
#define SX_WARN2(a,b) sx_trace(SX_TRACE_WARNING,__FILE__,__LINE__,a,b);

#define SX_ERROR(a,b...) sx_trace(SX_TRACE_ERROR,__FILE__,__FUNCTION__,\
	__LINE__,a, ## b);

#define SX_TRACE2(a,b...) sx_trace(SX_TRACE_TRACE,__FILE__,__FUNCTION__,\
	__LINE__,a, ## b);

#define SX_ASSERT(a,b) if(a) { sx_trace(SX_TRACE_WARNING,__FILE__,__LINE__,"condition %s failed", #a); return b; };

#endif



