blob: 63eeaf124daf86720d063c71fcd71b400f9ecb49 [file] [log] [blame]
Brian Silverman14fd0fb2014-01-14 21:42:01 -08001#ifndef AOS_LINUX_CODE_LOGGING_LOGGING_H_
2#define AOS_LINUX_CODE_LOGGING_LOGGING_H_
brians343bc112013-02-10 01:53:46 +00003
Brian Silvermanf665d692013-02-17 22:11:39 -08004#include "aos/common/logging/logging_impl.h"
Brian Silverman7faaec72014-05-26 16:25:38 -07005#include "aos/common/util/options.h"
brians343bc112013-02-10 01:53:46 +00006
Brian Silvermanf665d692013-02-17 22:11:39 -08007namespace aos {
Brian Silverman7faaec72014-05-26 16:25:38 -07008
9class RawQueue;
10
Brian Silvermanf665d692013-02-17 22:11:39 -080011namespace logging {
Brian Silverman14fd0fb2014-01-14 21:42:01 -080012namespace linux_code {
brians343bc112013-02-10 01:53:46 +000013
Brian Silverman14fd0fb2014-01-14 21:42:01 -080014// Calls AddImplementation to register the usual linux logging implementation
Brian Silvermanf665d692013-02-17 22:11:39 -080015// 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 Silverman78968542014-03-05 17:03:43 -080017// This function is usually called by aos::Init*.
Brian Silvermanf665d692013-02-17 22:11:39 -080018void Register();
brians343bc112013-02-10 01:53:46 +000019
Brian Silvermanf665d692013-02-17 22:11:39 -080020// Fairly simple wrappers around the raw queue calls.
brians343bc112013-02-10 01:53:46 +000021
Brian Silvermanf665d692013-02-17 22:11:39 -080022// This one never returns NULL if flags contains BLOCK.
Brian Silverman7faaec72014-05-26 16:25:38 -070023const LogMessage *ReadNext(Options<RawQueue> flags);
24const LogMessage *ReadNext(Options<RawQueue> flags, int *index);
Brian Silvermanf665d692013-02-17 22:11:39 -080025const LogMessage *ReadNext();
26LogMessage *Get();
27void Free(const LogMessage *msg);
28void Write(LogMessage *msg);
brians343bc112013-02-10 01:53:46 +000029
Brian Silverman14fd0fb2014-01-14 21:42:01 -080030} // namespace linux_code
Brian Silvermanf665d692013-02-17 22:11:39 -080031} // namespace logging
32} // namespace aos
brians343bc112013-02-10 01:53:46 +000033
34#endif