tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

CSFLog.h (2012B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 #ifndef CSFLOG_H
      6 #define CSFLOG_H
      7 
      8 #include <stdarg.h>
      9 
     10 typedef enum {
     11  CSF_LOG_ERROR = 1,
     12  CSF_LOG_WARNING,
     13  CSF_LOG_INFO,
     14  CSF_LOG_DEBUG,
     15  CSF_LOG_VERBOSE,
     16 } CSFLogLevel;
     17 
     18 #define CSFLogError(tag, format, ...) \
     19  CSFLog(CSF_LOG_ERROR, __FILE__, __LINE__, tag, format, ##__VA_ARGS__)
     20 #define CSFLogErrorV(tag, format, va_list_arg) \
     21  CSFLogV(CSF_LOG_ERROR, __FILE__, __LINE__, tag, format, va_list_arg)
     22 #define CSFLogWarn(tag, format, ...) \
     23  CSFLog(CSF_LOG_WARNING, __FILE__, __LINE__, tag, format, ##__VA_ARGS__)
     24 #define CSFLogWarnV(tag, format, va_list_arg) \
     25  CSFLogV(CSF_LOG_WARNING, __FILE__, __LINE__, tag, format, va_list_arg)
     26 #define CSFLogInfo(tag, format, ...) \
     27  CSFLog(CSF_LOG_INFO, __FILE__, __LINE__, tag, format, ##__VA_ARGS__)
     28 #define CSFLogInfoV(tag, format, va_list_arg) \
     29  CSFLogV(CSF_LOG_INFO, __FILE__, __LINE__, tag, format, va_list_arg)
     30 #define CSFLogDebug(tag, format, ...) \
     31  CSFLog(CSF_LOG_DEBUG, __FILE__, __LINE__, tag, format, ##__VA_ARGS__)
     32 #define CSFLogDebugV(tag, format, va_list_arg) \
     33  CSFLogV(CSF_LOG_DEBUG, __FILE__, __LINE__, tag, format, va_list_arg)
     34 #define CSFLogVerbose(tag, format, ...) \
     35  CSFLog(CSF_LOG_VERBOSE, __FILE__, __LINE__, tag, format, ##__VA_ARGS__)
     36 #define CSFLogVerboseV(tag, format, va_list_arg) \
     37  CSFLogV(CSF_LOG_VERBOSE, __FILE__, __LINE__, tag, format, va_list_arg)
     38 
     39 #ifdef __cplusplus
     40 extern "C" {
     41 #endif
     42 void CSFLog(CSFLogLevel priority, const char* sourceFile, int sourceLine,
     43            const char* tag, const char* format, ...)
     44 #ifdef __GNUC__
     45    __attribute__((format(printf, 5, 6)))
     46 #endif
     47    ;
     48 
     49 void CSFLogV(CSFLogLevel priority, const char* sourceFile, int sourceLine,
     50             const char* tag, const char* format, va_list args);
     51 
     52 int CSFLogTestLevel(CSFLogLevel priority);
     53 
     54 #ifdef __cplusplus
     55 }
     56 #endif
     57 
     58 #endif