/**
  ******************************************************************************
  * @file: log_test.h 
  * @author: WangSi
  * @version: V1.0
  * @date: 2018-10-28 15:30:45
  * @brief:   This file contains all the functions prototypes for the BOARD 
  *  log_test 
  ******************************************************************************
  * @attention
  *
  * FILE FOR MeiLing ONLY
  *
  * Copyright (C), 2018-2028, ChangHongMeiLing.SiChuan Homme IntelligentTechnology Co.,Ltd.
  ******************************************************************************
  */ 

/* Define to prevent recursive inclusion -------------------------------------*/

#ifndef _MULTI_PROTOCOL_LOG_TEST_H
#define _MULTI_PROTOCOL_LOG_TEST_H

#ifdef __cplusplus
extern "C" {
#endif
#include "stdio.h"
/* Includes ------------------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
#define  LOG_LEVEL_FATAL			1
#define  LOG_LEVEL_ERROR			2
#define  LOG_LEVEL_WARN				3
#define  LOG_LEVEL_NOTICE			4	//recommended settings for relase
#define  LOG_LEVEL_INFO				5	
#define  LOG_LEVEL_INFO_HTTP		6
#define  LOG_LEVEL_INFO_UDP			7
#define  LOG_LEVEL_INFO_TCP			8
#define  LOG_LEVEL_INFO_WIFI		9
#define  LOG_LEVEL_INFO_COM_SERVER	10	
#define  LOG_LEVEL_INFO_UART		11	//recommended settings for debug
#define  LOG_LEVEL_INFO_MONITOR 	12


/* Exported variables --------------------------------------------------------*/
unsigned char g_log_level = 12;	//lhy

/* Exported typedef ----------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
#define log_loc(level,format,...) \
	do{\
		if(g_log_level >= level){\
			printf("[%s][%s_%d]"format"\r\n", __FILE__, __FUNCTION__, __LINE__,##__VA_ARGS__);\
		}\
	}while(0)
		
#define log_info(level,format,...) \
	do{\
		if(g_log_level >= level){\
			printf("[%s]"format"\r\n",__FUNCTION__,##__VA_ARGS__);\
		}\
	}while(0)
					
#define log_info_hex(level,data,len) \
	do{\
		if(g_log_level >= level){ \
			int i = 0; \
			for(i = 0; i < len; ++ i) \
				printf("%02X ", data[i]&0xFF); \
			printf("\r\n\r\n");\
		}\
	}while(0)


#ifdef __cplusplus
}
#endif

#endif  /* _MULTI_PROTOCOL_LOG_TEST_H */

