blob: 191d4c77a44c393264e1fcef930a09ca61f01f86 [file] [log] [blame]
Brian Silvermand6974f42014-02-14 13:39:21 -08001#ifndef AOS_COMMON_LOGGING_QUEUE_LOGGING_H_
2#define AOS_COMMON_LOGGING_QUEUE_LOGGING_H_
3
4#include <stdio.h>
5#include <stdlib.h>
6
7#include <string>
8
9#include "aos/common/logging/logging.h"
10
11namespace aos {
12namespace logging {
13
14#define LOG_STRUCT(level, message, structure) \
15 do { \
16 static const ::std::string kAosLoggingMessage( \
17 LOG_SOURCENAME ": " STRINGIFY(__LINE__) ": " message); \
18 ::aos::logging::DoLogStruct(level, kAosLoggingMessage, structure); \
19 /* so that GCC knows that it won't return */ \
20 if (level == FATAL) { \
21 fprintf(stderr, "DoLogStruct(FATAL) fell through!!!!!\n"); \
22 printf("see stderr\n"); \
23 abort(); \
24 } \
25 } while (false)
Brian Silvermand6974f42014-02-14 13:39:21 -080026
27template <class T>
28void DoLogStruct(log_level level, const ::std::string &message,
29 const T &structure);
30
31} // namespace logging
32} // namespace aos
33
34#include "aos/common/logging/queue_logging-tmpl.h"
35
36#endif // AOS_COMMON_LOGGING_QUEUE_LOGGING_H_