Brian Silverman | f44f124 | 2015-12-05 20:19:48 -0500 | [diff] [blame^] | 1 | #ifndef AOS_COMMON_LOGGING_LINUX_LOGGING_H_ |
| 2 | #define AOS_COMMON_LOGGING_LINUX_LOGGING_H_ |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 3 | |
Brian Silverman | f665d69 | 2013-02-17 22:11:39 -0800 | [diff] [blame] | 4 | #include "aos/common/logging/logging_impl.h" |
Brian Silverman | 7faaec7 | 2014-05-26 16:25:38 -0700 | [diff] [blame] | 5 | #include "aos/common/util/options.h" |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 6 | |
Brian Silverman | f665d69 | 2013-02-17 22:11:39 -0800 | [diff] [blame] | 7 | namespace aos { |
Brian Silverman | 7faaec7 | 2014-05-26 16:25:38 -0700 | [diff] [blame] | 8 | |
| 9 | class RawQueue; |
| 10 | |
Brian Silverman | f665d69 | 2013-02-17 22:11:39 -0800 | [diff] [blame] | 11 | namespace logging { |
Brian Silverman | 14fd0fb | 2014-01-14 21:42:01 -0800 | [diff] [blame] | 12 | namespace linux_code { |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 13 | |
Brian Silverman | 14fd0fb | 2014-01-14 21:42:01 -0800 | [diff] [blame] | 14 | // Calls AddImplementation to register the usual linux logging implementation |
Brian Silverman | f665d69 | 2013-02-17 22:11:39 -0800 | [diff] [blame] | 15 | // which sends the messages through a queue. This implementation relies on |
| 16 | // another process(es) to read the log messages that it puts into the queue. |
Brian Silverman | 7896854 | 2014-03-05 17:03:43 -0800 | [diff] [blame] | 17 | // This function is usually called by aos::Init*. |
Brian Silverman | f665d69 | 2013-02-17 22:11:39 -0800 | [diff] [blame] | 18 | void Register(); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 19 | |
Brian Silverman | f665d69 | 2013-02-17 22:11:39 -0800 | [diff] [blame] | 20 | // Fairly simple wrappers around the raw queue calls. |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 21 | |
Brian Silverman | f665d69 | 2013-02-17 22:11:39 -0800 | [diff] [blame] | 22 | // This one never returns NULL if flags contains BLOCK. |
Brian Silverman | 7faaec7 | 2014-05-26 16:25:38 -0700 | [diff] [blame] | 23 | const LogMessage *ReadNext(Options<RawQueue> flags); |
| 24 | const LogMessage *ReadNext(Options<RawQueue> flags, int *index); |
Brian Silverman | f665d69 | 2013-02-17 22:11:39 -0800 | [diff] [blame] | 25 | const LogMessage *ReadNext(); |
| 26 | LogMessage *Get(); |
| 27 | void Free(const LogMessage *msg); |
| 28 | void Write(LogMessage *msg); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 29 | |
Brian Silverman | 14fd0fb | 2014-01-14 21:42:01 -0800 | [diff] [blame] | 30 | } // namespace linux_code |
Brian Silverman | f665d69 | 2013-02-17 22:11:39 -0800 | [diff] [blame] | 31 | } // namespace logging |
| 32 | } // namespace aos |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 33 | |
Brian Silverman | f44f124 | 2015-12-05 20:19:48 -0500 | [diff] [blame^] | 34 | #endif // AOS_COMMON_LOGGING_LINUX_LOGGING_H_ |