brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 1 | #ifndef AOS_CRIO_CRIO_LOGGING_LOGGING_H_ |
| 2 | #define AOS_CRIO_CRIO_LOGGING_LOGGING_H_ |
| 3 | |
| 4 | #ifndef AOS_COMMON_LOGGING_LOGGING_H_ |
| 5 | #error This file may only be #included through common/logging/logging.h!!! |
| 6 | #endif |
| 7 | |
| 8 | #undef extern |
| 9 | #undef const |
| 10 | #undef ERROR |
| 11 | |
| 12 | #include <msgQLib.h> |
| 13 | #include <stdint.h> |
| 14 | |
| 15 | //#define LOG(level, fmt, args...) printf(STRINGIFY(level) ": " fmt, ##args) |
| 16 | #define LOG(level, fmt, args...) \ |
| 17 | ::aos::logging::Do(level, \ |
| 18 | LOG_SOURCENAME ": " STRINGIFY(__LINE__) ": " fmt, \ |
| 19 | ##args) |
| 20 | //#define LOG(...) |
| 21 | |
| 22 | namespace aos { |
| 23 | namespace logging { |
| 24 | |
| 25 | // Initialize internal variables and start up the task that sends the logs to |
| 26 | // the atom. Must be called before Do. |
| 27 | void Start(); |
| 28 | // The function that the LOG macro actually calls. Queues up a message for the |
| 29 | // task to send. Start must be called before this function is. |
| 30 | int Do(log_level level, const char *format, ...) |
| 31 | __attribute__((format(printf, 2, 3))); |
| 32 | |
| 33 | } // namespace logging |
| 34 | } // namespace aos |
| 35 | |
| 36 | #endif // AOS_CRIO_CRIO_LOGGING_LOGGING_H_ |