1 /* 2 * Copyright(c) 2019 Intel Corporation 3 * 4 * This source code is subject to the terms of the BSD 2 Clause License and 5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6 * was not distributed with this source code in the LICENSE file, you can 7 * obtain it at https://www.aomedia.org/license/software-license. If the Alliance for Open 8 * Media Patent License 1.0 was not distributed with this source code in the 9 * PATENTS file, you can obtain it at https://www.aomedia.org/license/patent-license. 10 */ 11 #ifndef EbLog_h 12 #define EbLog_h 13 14 #ifndef LOG_TAG 15 #define LOG_TAG "Svt" 16 #endif 17 18 typedef enum { 19 SVT_LOG_ALL = -1, 20 SVT_LOG_FATAL = 0, 21 SVT_LOG_ERROR = 1, 22 SVT_LOG_WARN = 2, 23 SVT_LOG_INFO = 3, 24 SVT_LOG_DEBUG = 4, 25 } SvtLogLevel; 26 27 //define this to turn off all library log 28 //#define SVT_LOG_QUIET 29 #ifndef SVT_LOG_QUIET 30 31 //SVT_LOG will not output the prefix. you can contorl the output style. 32 #define SVT_LOG(format, ...) svt_log(SVT_LOG_ALL, NULL, format, ##__VA_ARGS__) 33 34 #define SVT_DEBUG(format, ...) svt_log(SVT_LOG_DEBUG, LOG_TAG, format, ##__VA_ARGS__) 35 #define SVT_INFO(format, ...) svt_log(SVT_LOG_INFO, LOG_TAG, format, ##__VA_ARGS__) 36 #define SVT_WARN(format, ...) svt_log(SVT_LOG_WARN, LOG_TAG, format, ##__VA_ARGS__) 37 #define SVT_ERROR(format, ...) svt_log(SVT_LOG_ERROR, LOG_TAG, format, ##__VA_ARGS__) 38 #define SVT_FATAL(format, ...) svt_log(SVT_LOG_FATAL, LOG_TAG, format, ##__VA_ARGS__) 39 40 #else 41 42 #define SVT_LOG(format, ...) \ 43 do { \ 44 } while (0) 45 #define SVT_DEBUG(format, ...) \ 46 do { \ 47 } while (0) 48 #define SVT_INFO(format, ...) \ 49 do { \ 50 } while (0) 51 #define SVT_WARN(format, ...) \ 52 do { \ 53 } while (0) 54 #define SVT_ERROR(format, ...) \ 55 do { \ 56 } while (0) 57 #define SVT_FATAL(format, ...) \ 58 do { \ 59 } while (0) 60 61 #endif //SVT_LOG_QUIET 62 63 void svt_log_init(); 64 void svt_log(SvtLogLevel level, const char* tag, const char* format, ...); 65 66 #endif //EbLog_h 67