1 /* 2 * Copyright (c) 2020 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef LIBTEEC_TEEC_LOG_H 17 #define LIBTEEC_TEEC_LOG_H 18 19 #include <stdio.h> 20 21 enum { 22 TEE_LOG_VERBOSE = 0, 23 TEE_LOG_DEBUG, 24 TEE_LOG_INFO, 25 TEE_LOG_WARN, 26 TEE_LOG_ERROR, 27 }; 28 29 #ifdef DEF_ENG 30 #define TEE_LOG_MASK TEE_LOG_INFO 31 #else 32 #define TEE_LOG_MASK TEE_LOG_WARN 33 #endif 34 35 #define tlogv(fmt, args...) \ 36 do { \ 37 if (TEE_LOG_VERBOSE >= TEE_LOG_MASK) \ 38 printf("%s: " fmt, __func__, ## args); \ 39 } while (0) 40 41 #define tlogd(fmt, args...) \ 42 do { \ 43 if (TEE_LOG_DEBUG >= TEE_LOG_MASK) \ 44 printf("%s: " fmt, __func__, ## args); \ 45 } while (0) 46 47 #define tlogi(fmt, args...) \ 48 do { \ 49 if (TEE_LOG_INFO >= TEE_LOG_MASK) \ 50 printf("%s: " fmt, __func__, ## args); \ 51 } while (0) 52 53 #define tlogw(fmt, args...) \ 54 do { \ 55 if (TEE_LOG_WARN >= TEE_LOG_MASK) \ 56 printf("%s: " fmt, __func__, ## args); \ 57 } while (0) 58 59 #define tloge(fmt, args...) \ 60 do { \ 61 if (TEE_LOG_ERROR >= TEE_LOG_MASK) \ 62 printf("%s: " fmt, __func__, ## args); \ 63 } while (0) 64 65 #endif 66