75 lines
2.5 KiB
C
75 lines
2.5 KiB
C
// +FHDR------------------------------------------------------------
|
|
// Copyright (c) 2022 SmartLogic.
|
|
// ALL RIGHTS RESERVED
|
|
// -----------------------------------------------------------------
|
|
// Filename : ucp_printf.h
|
|
// Author : xianfeng.du
|
|
// Created On : 2022-06-25
|
|
// Last Modified :
|
|
// -----------------------------------------------------------------
|
|
// Description:
|
|
//
|
|
//
|
|
// -FHDR------------------------------------------------------------
|
|
|
|
|
|
#ifndef __UCP_RINTF_H__
|
|
#define __UCP_RINTF_H__
|
|
|
|
#include <stdio.h>
|
|
//#include <stddef.h>
|
|
|
|
|
|
#define PRINT_OFF 0x00000000 // close all PRINT
|
|
#define PRINT_ERROR 0x00000001
|
|
#define PRINT_WARN 0x00000002
|
|
#define PRINT_DEBUG 0x00000004
|
|
#define PRINT_LOG 0x00000008
|
|
#define PRINT_TICK 0x00000010
|
|
|
|
//#define UCP_PRINT_LEVEL (PRINT_OFF)
|
|
#define UCP_PRINT_LEVEL (PRINT_ERROR | PRINT_WARN |PRINT_DEBUG|PRINT_LOG | PRINT_TICK)
|
|
//#define UCP_PRINT_LEVEL (PRINT_ERROR |PRINT_DEBUG| PRINT_SHELL)
|
|
|
|
#if (UCP_PRINT_LEVEL & PRINT_ERROR)
|
|
//#define UCP_PRINT_ERROR(fmt, args...) printf(__FILE__ ": [ERROR]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
|
|
#define UCP_PRINT_ERROR(fmt, args...) osp_log_output(PRINT_ERROR, "[ERROR]:" fmt "\n", ##args)
|
|
#else
|
|
#define UCP_PRINT_ERROR(fmt, args...)
|
|
#endif
|
|
|
|
#if (UCP_PRINT_LEVEL & PRINT_WARN)
|
|
//#define UCP_PRINT_WARN(fmt, args...) printf(__FILE__ ": [WARN]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
|
|
#define UCP_PRINT_WARN(fmt, args...) osp_log_output(PRINT_WARN, "[WARN]:" fmt "\n", ##args)
|
|
#else
|
|
#define UCP_PRINT_WARN(fmt, args...)
|
|
#endif
|
|
|
|
#if (UCP_PRINT_LEVEL & PRINT_LOG)
|
|
//#define UCP_PRINT_LOG(fmt, args...) printf(__FILE__ ": [LOG]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
|
|
#define UCP_PRINT_LOG(fmt, args...) osp_log_output(PRINT_LOG, "[LOG]:" fmt "\n", ##args)
|
|
#else
|
|
#define UCP_PRINT_LOG(fmt, args...)
|
|
#endif
|
|
|
|
#if (UCP_PRINT_LEVEL & PRINT_DEBUG)
|
|
//#define UCP_PRINT_LOG(fmt, args...) printf(__FILE__ ": [LOG]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
|
|
#define UCP_PRINT_DEBUG(fmt, args...) osp_log_output(PRINT_DEBUG, "[DEBUG]:" fmt "\n", ##args)
|
|
#else
|
|
#define UCP_PRINT_DEBUG(fmt, args...)
|
|
#endif
|
|
|
|
#if (UCP_PRINT_LEVEL & PRINT_TICK)
|
|
//#define UCP_PRINT_TICK(fmt, args...) printf(__FILE__ ": [TICK]: %d: %s():" fmt "\n", __LINE__, __func__, ##args)
|
|
#define UCP_PRINT_TICK(fmt, args...) osp_log_output(PRINT_TICK, "[TICK]:" fmt "\n", ##args)
|
|
#else
|
|
#define UCP_PRINT_TICK(fmt, args...)
|
|
#endif
|
|
|
|
#define UCP_PRINT_SHELL(fmt, args...)
|
|
|
|
extern void osp_log_output(unsigned char level, const char *fmt, ...);
|
|
|
|
|
|
#endif
|