1 
2 /**
3   * @file     	HaasLog.h
4   * @author   	HaasAI Group
5   * @version	V1.0.0
6   * @date    	2021-01-10
7   * @license  	GNU General Public License (GPL)
8   * @brief
9   * @attention
10   *  This file is part of HaasAI.                                \n
11   *  This program is free software; you can redistribute it and/or modify 		\n
12   *  it under the terms of the GNU General Public License version 3 as 		    \n
13   *  published by the Free Software Foundation.                               	\n
14   *  You should have received a copy of the GNU General Public License   		\n
15   *  along with HaasAI. If not, see <http://www.gnu.org/licenses/>.       			\n
16   *  Unless required by applicable law or agreed to in writing, software       	\n
17   *  distributed under the License is distributed on an "AS IS" BASIS,         	\n
18   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  	\n
19   *  See the License for the specific language governing permissions and     	\n
20   *  limitations under the License.   											\n
21   *   																			\n
22   * @htmlonly
23   * <span style="font-weight: bold">History</span>
24   * @endhtmlonly
25   * Version|Author|Date|Describe
26   * ------|----|------|--------
27   * V1.0|HaasAI Group|2021-01-10|Create File
28   * <h2><center>&copy;COPYRIGHT 2021 WELLCASA All Rights Reserved.</center></h2>
29   */
30 #ifndef HAAS_LOG_H
31 #define HAAS_LOG_H
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #include <stdio.h>
38 #include <string.h>
39 
40 //#define ENABLE_DEBUG
41 
42 #ifdef ENABLE_DEBUG
43 #define LOG_ENABLE_D
44 #endif
45 
46 #define LOG_ENABLE_I
47 #define LOG_ENABLE_W
48 #define LOG_ENABLE_E
49 
50 #ifdef LOG_ENABLE_D
51 #define LOG_D(fmt, args...) \
52     do {printf("%s:%d", __FUNCTION__, __LINE__); printf("\n\r");printf(fmt,##args);printf("\n\r");} while(0)
53 #else
54 #define LOG_D(fmt, args...)
55 #endif
56 
57 #ifdef LOG_ENABLE_I
58 #define LOG_I(fmt, args...) \
59     do {printf("%s:%d", __FUNCTION__, __LINE__); printf("\n\r");printf(fmt,##args);printf("\n\r");} while(0)
60 #else
61 #define LOG_I(fmt, args...)
62 #endif
63 
64 #ifdef LOG_ENABLE_W
65 #define LOG_W(fmt, args...) \
66     do {printf("%s:%d", __FUNCTION__, __LINE__); printf("\n\r");printf(fmt,##args);printf("\n\r");} while(0)
67 #else
68 #define LOG_W(fmt, args...)
69 #endif
70 
71 #ifdef LOG_ENABLE_E
72 #define LOG_E(fmt, args...) \
73     do {printf("%s:%d", __FUNCTION__, __LINE__); printf("\n\r");printf(fmt,##args);printf("\n\r");} while(0)
74 #else
75 #define LOG_E(fmt, args...)
76 #endif
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif
83