nt9856x/code/lib/source/sifar/code/include/sf_log.h.bak
2023-05-17 15:33:39 +08:00

117 lines
3.9 KiB
C

/**************************************************************************
*
* Copyright (c) 2015-2020 by WuYuan Technology, Inc.
*
* This software is copyrighted by and is the property of SiFar
* Technology, Inc.. All rights are reserved by SiFar Technology, Inc..
* This software may only be used in accordance with the corresponding
* license agreement. Any unauthorized use, duplication, distribution,
* or disclosure of this software is expressly forbidden.
*
* This Copyright notice MUST not be removed or modified without prior
* written consent of SiFar Technology, Inc..
*
* WuYuan Technology, Inc. reserves the right to modify this software without notice.
*
* Author: Kola
* Ver: 1.0.0 2021.04.15
* Description: create
**************************************************************************/
#ifndef _SF_LOG_H_
#define _SF_LOG_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <pthread.h>
#include "sf_type.h"
#include "sf_inc.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#if 0
#define LOG_TMP_MOD_FILE_PATH SF_SD_ROOT"SF_GPS.TXT"
#define LOG_AT_FILE_PATH SF_SD_ROOT"SF_GPS.TXT"
#define WARNING_FILE_PATH SF_SD_ROOT"warning.txt"
#define INFO_FILE_PATH SF_SD_ROOT"info.txt"
#define SF_ENCRYPTION_ENBLE 1
typedef enum SF_LOG_LEVEL_E
{
SF_LOG_LEVEL_ERROR = 0, /**<error conditions */
SF_LOG_LEVEL_WARNING, /**<warning conditions */
SF_LOG_LEVEL_INFO, /**<informational */
SF_LOG_LEVEL_DEBUG, /**<debug-level */
} SF_LOG_LEVEL_e;
#define NONE "\033[m"
#define RED "\033[0;32;31m"
#define LIGHT_RED "\033[1;31m"
#define GREEN "\033[0;32;32m"
#define LIGHT_GREEN "\033[1;32m"
#define BLUE "\033[0;32;34m"
#define LIGHT_BLUE "\033[1;34m"
#define DARY_GRAY "\033[1;30m"
#define CYAN "\033[0;36m"
#define LIGHT_CYAN "\033[1;36m"
#define PURPLE "\033[0;35m"
#define LIGHT_PURPLE "\033[1;35m"
#define BROWN "\033[0;33m"
#define YELLOW "\033[1;33m"
#define LIGHT_GRAY "\033[0;37m"
#define WHITE "\033[1;37m"
//#define MLOGI(format, args...) (printf( LIGHT_GREEN "[INFO]: %s[%d]:"NONE format, __FUNCTION__ , __LINE__, ##args))
//
//#define MLOGD(format, args...) (printf( LIGHT_PURPLE "[DEBUG]: %s[%d]:"NONE format, __FUNCTION__ , __LINE__, ##args))
//
//#define MLOGW(format, args...) (printf( YELLOW "[WARN]: %s[%d]:"NONE format, __FUNCTION__ , __LINE__, ##args))
//
//#define MLOGE(format, args...) (printf( LIGHT_RED "[ERROR]: %s[%d]:"NONE format, __FUNCTION__ , __LINE__, ##args))
#define MLOGE(fmt, args...) sf_log_file(SF_LOG_LEVEL_ERROR, __FUNCTION__, __LINE__, fmt, ##args)
#define MLOGW(fmt, args...) sf_log_file(SF_LOG_LEVEL_WARNING, __FUNCTION__, __LINE__, fmt, ##args)
#define MLOGI(fmt, args...) sf_log_file(SF_LOG_LEVEL_INFO, __FUNCTION__, __LINE__, fmt, ##args)
#define MLOGD(fmt, args...) sf_log_file(SF_LOG_LEVEL_DEBUG, __FUNCTION__, __LINE__, fmt, ##args)
#define SLOGE(fmt, args...) sf_log_file(SF_LOG_LEVEL_ERROR, __FUNCTION__, __LINE__, fmt, ##args)
#define SLOGW(fmt, args...) sf_log_file(SF_LOG_LEVEL_WARNING, __FUNCTION__, __LINE__, fmt, ##args)
#define SLOGI(fmt, args...) sf_log_file(SF_LOG_LEVEL_INFO, __FUNCTION__, __LINE__, fmt, ##args)
#define SLOGD(fmt, args...) sf_log_file(SF_LOG_LEVEL_DEBUG, __FUNCTION__, __LINE__, fmt, ##args)
#define SLOG_DM(fmt, args...) sf_log_module(__FUNCTION__, __LINE__, fmt, ##args)
SINT32 sf_log_Level_set(SF_LOG_LEVEL_e enLevel);
SF_LOG_LEVEL_e sf_log_Level_get(void);
void sf_log_module(const char *pszFunc, U32 u32Line, const char *pszFmt, ...);
void sf_log_file(SF_LOG_LEVEL_e enLevel,const char *pszFunc, U32 u32Line,char *pszFmt, ...);
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif