2 * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #define SST_LOG_RED "\033[31m"
19 #define SST_LOG_GREEN "\033[32m"
20 #define SST_LOG_BROWN "\033[33m"
21 #define SST_LOG_BLUE "\033[34m"
22 #define SST_LOG_END "\033[0m"
42 #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
43 #define __DBG(fmt, arg...) printf("[SST]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
44 #define __INFO(fmt, arg...) printf("[SST]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
45 #define __WARN(fmt, arg...) printf("[SST]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
46 #define __ERR(fmt, arg...) printf("[SST]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
47 #define __SECU_ERR(fmt, arg...) printf("[SST]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
49 #define LOG_TAG "SYSTEM-SETTINGS"
51 #define __DBG(fmt, arg...) SLOGD(fmt, ##arg)
52 #define __INFO(fmt, arg...) SLOGI(fmt, ##arg)
53 #define __WARN(fmt, arg...) SLOGW(fmt, ##arg)
54 #define __ERR(fmt, arg...) SLOGE(fmt, ##arg)
55 #define __SECU_ERR(fmt, arg...) SECURE_SLOGE(fmt, ##arg)
56 #endif /* SST_STDOUT */
59 #define _DBG(fmt, arg...) __DBG(SST_LOG_BROWN "<Test>" SST_LOG_END fmt, ##arg)
60 #define _INFO(fmt, arg...) __INFO(SST_LOG_BLUE "<Test>" SST_LOG_END fmt, ##arg)
61 #define _WARN(fmt, arg...) __WARN(SST_LOG_GREEN "<Test>" SST_LOG_END fmt, ##arg)
62 #define _ERR(fmt, arg...) __ERR(SST_LOG_RED "<Test>" SST_LOG_END fmt, ##arg)
64 #define _DBG(fmt, arg...) __DBG(fmt, ##arg)
65 #define _INFO(fmt, arg...) __INFO(fmt, ##arg)
66 #define _WARN(fmt, arg...) __WARN(fmt, ##arg)
67 #define _ERR(fmt, arg...) __ERR(fmt, ##arg)
73 #define DBG(fmt, arg...) _DBG(fmt, ##arg)
74 #define WARN(fmt, arg...) _WARN(fmt, ##arg)
75 #define ERR(fmt, arg...) _ERR(fmt, ##arg)
76 #define INFO(fmt, arg...) _INFO(fmt, ##arg)
77 #define SECURE_ERR(fmt, arg...) __SECU_ERR(SST_LOG_GREEN fmt SST_LOG_END, ##arg)
79 #else /* SST_DEBUGGING */
80 #define DBG(fmt, arg...)
81 #define WARN(fmt, arg...)
82 #define ERR(fmt, arg...)
83 #define INFO(fmt, arg...)
84 #define SECURE_ERR(fmt, arg...)
86 #endif /* SST_DEBUGGING */
88 #define RET_IF(expr) \
96 #define RETV_IF(expr, val) \
104 #define RETM_IF(expr, fmt, arg...) \
112 #define RETVM_IF(expr, val, fmt, arg...) \
120 #define ERR_IF(expr) \
123 ERR("(%s)", #expr); \
127 #define WARN_IF(expr, fmt, arg...) \