#ifndef __SSL_LOG_H__
#define __SSL_LOG_H__

#include "platform.h"

////////////////////////////////////////////////////////////////////////////
extern void softsim_printf(const char *fmt, ...);


#define LOG_LEVEL_INFO    7
#define LOG_LEVEL_DEBUG   4
#define LOG_LEVEL_ERROR   0

#define LOG_LEVEL_DEFAULT LOG_LEVEL_INFO

#define MLOG_I(...)                  \
    if(LOG_LEVEL_DEFAULT >= LOG_LEVEL_INFO){     \
        softsim_printf(__VA_ARGS__);      \
    }

#define MLOG_D(...)                  \
    if(LOG_LEVEL_DEFAULT >= LOG_LEVEL_DEBUG){     \
        softsim_printf(__VA_ARGS__);      \
    }

#define _MLOG_E(...)                  \
    if(LOG_LEVEL_DEFAULT >= LOG_LEVEL_ERROR){     \
        softsim_printf(__VA_ARGS__);      \
    }

#define MLOG_E(fmt, args...)  \
    _MLOG_E("[ FUNC: %s ] " fmt, __func__, ##args);

#ifdef MEMORY_DEBUG
#define MLOG_M(fmt, args...)  \
    _MLOG_E("[ FUNC  %s(%d) ] "fmt, __func__, __LINE__, ##args);
#else
#define MLOG_M(fmt, args...)  {}
#endif

#define FUNC_ENTER(fmt, args...)  \
    MLOG_I("[ ENTER ] func: %s(%d) "fmt, __func__, __LINE__, ##args);

#define FUNC_EXIT(fmt, args...)  \
    MLOG_I("[ EXIT ] func: %s "fmt, __func__, ##args);

#endif /*__SSL_LOG_H__*/
