xref: /OK3568_Linux_fs/external/recovery/update_engine/log.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 // Copyright 2013 Google Inc. All Rights Reserved.
2 //
3 // Log - Platform independent interface for a Logging class
4 //
5 #ifndef update_engine_CORE_LOG_H_
6 #define update_engine_CORE_LOG_H_
7 
8 // Simple logging class. The implementation is platform dependent.
9 
10 typedef enum {
11     LOG_ERROR,
12     LOG_WARN,
13     LOG_INFO,
14     LOG_DEBUG,
15     LOG_VERBOSE,
16     LOG_MAX
17 } LogPriority;
18 
19 // Enable/disable verbose logging (LOGV).
20 // This function is supplied for cases where the system layer does not
21 // initialize logging.  This is also needed to initialize logging in
22 // unit tests.
23 void InitLogging(LogPriority level);
24 
25 void Log(const char* file, int line, LogPriority level, const char* fmt, ...);
26 
27 // Log APIs
28 #define LOGE(...) Log(__FILE__, __LINE__, LOG_ERROR, ##__VA_ARGS__)
29 #define LOGW(...) Log(__FILE__, __LINE__, LOG_WARN, ##__VA_ARGS__)
30 #define LOGI(...) Log(__FILE__, __LINE__, LOG_INFO, ##__VA_ARGS__)
31 #define LOGD(...) Log(__FILE__, __LINE__, LOG_DEBUG, ##__VA_ARGS__)
32 #define LOGV(...) Log(__FILE__, __LINE__, LOG_VERBOSE, ##__VA_ARGS__)
33 
34 #endif  // update_engine_CORE_LOG_H_
35