blob: c3dbf2a2d4f6c3c9f960ddf5409a862edc0ac9b1 [file] [log] [blame]
brians343bc112013-02-10 01:53:46 +00001#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
22namespace aos {
23namespace logging {
24
25// Initialize internal variables and start up the task that sends the logs to
26// the atom. Must be called before Do.
27void 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.
30int 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_