Viam C++ SDK current
Loading...
Searching...
No Matches
log_backend.hpp
1#pragma once
2
3#include <boost/log/core/record_view.hpp>
4#include <boost/log/sinks/basic_sink_backend.hpp>
5#include <boost/log/sinks/sync_frontend.hpp>
6
8
9namespace viam {
10namespace sdk {
11namespace impl {
12
13struct LogBackend;
14
15using SinkType = boost::log::sinks::synchronous_sink<LogBackend>;
16
17// Log backend which implements sending messages to RDK.
18struct LogBackend : boost::log::sinks::basic_sink_backend<boost::log::sinks::synchronized_feeding> {
19 LogBackend(RobotClient* p) : parent(p) {}
20
21 void consume(const boost::log::record_view&) const;
22
23 static boost::shared_ptr<SinkType> create(RobotClient* p);
24
25 RobotClient* parent;
26};
27
28// TBD if we want to expose this to users, but for now it is an implementation detail.
29// Disabling console logging is implemented by changing the filter on the console sink to reject all
30// messages unless they have a "force" flag set to true.
31BOOST_LOG_ATTRIBUTE_KEYWORD_TYPE(attr_console_force, "force", bool);
32
33} // namespace impl
34} // namespace sdk
35} // namespace viam
gRPC client for a robot, to be used for all interactions with a robot. There are two ways to instanti...
Definition client.hpp:39
gRPC client implementation for a robot.
Definition log_backend.hpp:18