#ifndef _LOG_DEF_H
#define _LOG_DEF_H

#include "slog.h"

#ifdef WIN32
#define mc_log(level, fmt, args...) printf(fmt, args...)
#else
#define mc_log(level, fmt, args...) \
do{ \
	slog(level,VS_MOD_SS_MC, "[%s]" fmt, __func__, ##args); \
}while(0)
#endif

#ifdef WIN32
#define MC_TRACE(format, arg...) printf(fmt, args...)
#define MC_INFO(format, arg...)  printf(fmt, args...)
#define MC_WARN(format, arg...)  printf(fmt, args...)
#define MC_ERROR(format, arg...) printf(fmt, args...)
#define MC_FATAL(format, arg...) printf(fmt, args...)
#else
#define MC_TRACE(format, arg...) \
    slog(SLOG_LVL_TRACE, VS_MOD_SS_MC, "[%s] " format, __func__, ##arg)
#define MC_INFO(format, arg...)  \
    slog(SLOG_LVL_INFO, VS_MOD_SS_MC, "[%s] " format, __func__, ##arg)
#define MC_WARN(format, arg...)  \
    slog(SLOG_LVL_WARNING, VS_MOD_SS_MC, "[%s] " format, __func__, ##arg)
#define MC_ERROR(format, arg...) \
    slog(SLOG_LVL_ERROR, VS_MOD_SS_MC, "[%s] " format, __func__, ##arg)
#define MC_FATAL(format, arg...) \
    slog(SLOG_LVL_FATAL, VS_MOD_SS_MC,  "[%s] " format, __func__, ##arg)
#endif


#define RBF_TRACE(format, arg...) \
    slog(SLOG_LVL_TRACE, m_nModule, "[%s] " format, __func__, ##arg)
#define RBF_INFO(format, arg...)  \
    slog(SLOG_LVL_INFO, m_nModule, "[%s] " format, __func__, ##arg)
#define RBF_WARN(format, arg...)  \
    slog(SLOG_LVL_WARNING, m_nModule, "[%s] " format, __func__, ##arg)
#define RBF_ERROR(format, arg...) \
    slog(SLOG_LVL_ERROR, m_nModule, "[%s] " format, __func__, ##arg)
#define RBF_FATAL(format, arg...) \
    slog(SLOG_LVL_FATAL, m_nModule,  "[%s] " format, __func__, ##arg)



#ifdef WIN32
#define VMS_ERROR printf
#define VMS_INFO printf
#define VMS_TRACE printf
#else
#define VMS_ERROR(fmt, args...) slog(SLOG_LVL_ERROR, VS_MOD_VMS_AUTH, "[%s].%d:"fmt, __func__, __LINE__, ##args); 
#define VMS_WARN(fmt, args...) slog(SLOG_LVL_WARNING, VS_MOD_VMS_AUTH, "[%s].%d:"fmt, __func__, __LINE__, ##args); 
#define VMS_INFO(fmt, args...) slog(SLOG_LVL_INFO, VS_MOD_VMS_AUTH, "[%s] " fmt, __func__, ##args);
#define VMS_TRACE(fmt, args...) slog(SLOG_LVL_TRACE, VS_MOD_VMS_AUTH, "[%s] " fmt, __func__, ##args);
#endif

#ifdef WIN32
//#define vms_log(level, fmt, args...) printf(fmt, args...)
#else
#define vms_log(level, fmt, args...) \
do{ \
	slog(level,VS_MOD_VMS_AUTH, "[%s] " fmt, __func__, ##args); \
}while(0)
#endif


#define FM_TRACE(format, arg...) \
    slog(SLOG_LVL_TRACE, VS_MOD_CTM, "[%s] " format, __func__, ##arg)
#define FM_INFO(format, arg...)  \
    slog(SLOG_LVL_INFO, VS_MOD_CTM, "[%s] " format, __func__, ##arg)
#define FM_WARN(format, arg...)  \
    slog(SLOG_LVL_WARNING, VS_MOD_CTM, "[%s] " format, __func__, ##arg)
#define FM_ERROR(format, arg...) \
    slog(SLOG_LVL_ERROR, VS_MOD_CTM, "[%s].%d " format, __func__, __LINE__, ##arg)
#define FM_FATAL(format, arg...) \
    slog(SLOG_LVL_FATAL, VS_MOD_CTM, "[%s] " format, __func__, ##arg)


#ifdef LINUX
#define CTM_TRACE(format, arg...) slog(SLOG_LVL_TRACE, VS_MOD_CTM, "[%s] " format, __func__, ##arg)
#define CTM_INFO(format, arg...) slog(SLOG_LVL_INFO, VS_MOD_CTM, "[%s] " format, __func__, ##arg)
#define CTM_WARN(format, arg...) slog(SLOG_LVL_WARNING, VS_MOD_CTM, "[%s] " format, __func__, ##arg)
#define CTM_ERROR(format, arg...) slog(SLOG_LVL_ERROR, VS_MOD_CTM, "[%s] " format, __func__, ##arg)
#define CTM_FATAL(format, arg...) slog(SLOG_LVL_FATAL, VS_MOD_CTM, "[%s] " format, __func__, ##arg)
#else
#define CTM_TRACE(format, arg...) 
#define CTM_INFO(format, arg...)  
#define CTM_WARN(format, arg...)  
#define CTM_ERROR(format, arg...) 
#define CTM_FATAL(format, arg...) 
#endif


#define BSDDB_TRACE(format, arg...) \
    slog(SLOG_LVL_TRACE, VS_MOD_BSD_DB, "[%s] " format, __func__, ##arg)
#define BSDDB_INFO(format, arg...)  \
    slog(SLOG_LVL_INFO, VS_MOD_BSD_DB, "[%s] " format, __func__, ##arg)
#define BSDDB_WARN(format, arg...)  \
    slog(SLOG_LVL_WARNING, VS_MOD_BSD_DB, "[%s] " format, __func__, ##arg)
#define BSDDB_ERROR(format, arg...) \
    slog(SLOG_LVL_ERROR, VS_MOD_BSD_DB, "[%s] " format, __func__, ##arg)
#define BSDDB_FATAL(format, arg...) \
    slog(SLOG_LVL_FATAL, VS_MOD_BSD_DB,  "[%s] " format, __func__, ##arg)





#endif
