1 #pragma once 2 3 #include <cstdint> 4 #include <cstdio> 5 6 // Outputs a log line using Google's standard prefix. (http://go/logging#prefix) 7 // 8 // Do not use this function directly. Instead, use one of the logging macros below. 9 // 10 // stream: file handle to output to. 11 // severity: single character to indicate severity: 'V', 'D', 'I', 'W', 'E', or 'F'. 12 // file: name of the file where the message comes from (typically __FILE__) 13 // line: line number where the message comes from (typically __LINE__) 14 // timestamp_us: for testing only - timestamp of the log in microseconds since the Unix epoch. 15 // Pass 0 to use the current time. 16 // format: printf-style format specifier 17 void OutputLog(FILE* stream, char severity, const char* file, unsigned int line, 18 int64_t timestamp_us, const char* format, ...); 19 20 #define GFXSTREAM_LOG(file, severity, fmt, ...) \ 21 OutputLog(file, severity, __FILE__, __LINE__, 0, fmt, ##__VA_ARGS__) 22 23 //#define ENABLE_GL_LOG 1 24 #if defined(ENABLE_GL_LOG) 25 #define GL_LOG(fmt, ...) GFXSTREAM_LOG(stderr, 'I', fmt, ##__VA_ARGS__) 26 #else 27 #define GL_LOG(...) ((void)0) 28 #endif 29 30 //#define ENABLE_DECODER_LOG 1 31 #if defined(ENABLE_DECODER_LOG) 32 #define DECODER_DEBUG_LOG(fmt, ...) GFXSTREAM_LOG(stderr, 'I', fmt, ##__VA_ARGS__) 33 #else 34 #define DECODER_DEBUG_LOG(...) ((void)0) 35 #endif 36 37 //#define ENABLE_DISPATCH_LOG 1 38 #if defined(ENABLE_DISPATCH_LOG) 39 #define DISPATCH_DEBUG_LOG(fmt, ...) GFXSTREAM_LOG(stderr, 'I', fmt, ##__VA_ARGS__) 40 #else 41 #define DISPATCH_DEBUG_LOG(...) ((void)0) 42 #endif 43 44 #define ERR(fmt, ...) \ 45 do { \ 46 GFXSTREAM_LOG(stderr, 'E', fmt, ##__VA_ARGS__); \ 47 } while (0) 48 49 #define INFO(fmt, ...) \ 50 do { \ 51 GFXSTREAM_LOG(stdout, 'I', fmt, ##__VA_ARGS__); \ 52 } while (0) 53