Apollo  6.0
Open source self driving car software
monitor_logger.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2017 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 
22 #pragma once
23 
24 #include <memory>
25 #include <string>
26 #include <utility>
27 #include <vector>
28 
29 #include "cyber/cyber.h"
30 #include "modules/common/monitor_log/proto/monitor_log.pb.h"
32 
37 namespace apollo {
38 namespace common {
39 namespace monitor {
40 
41 using MessageItem = std::pair<MonitorMessageItem::LogLevel, std::string>;
42 
52  public:
53  virtual ~MonitorLogger() = default;
54 
59  virtual void Publish(const MonitorMessageItem::MessageSource &source,
60  const std::vector<MessageItem> &messages) const;
61 
62  private:
63  virtual void DoPublish(MonitorMessage *message) const;
64 
65  MonitorMessageItem::MessageSource source_;
66  std::unique_ptr<cyber::Node> node_;
67  std::shared_ptr<cyber::Writer<MonitorMessage>> monitor_msg_writer_;
68 
70 };
71 
72 } // namespace monitor
73 } // namespace common
74 } // namespace apollo
virtual void Publish(const MonitorMessageItem::MessageSource &source, const std::vector< MessageItem > &messages) const
Publish the messages.
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
std::pair< MonitorMessageItem::LogLevel, std::string > MessageItem
Definition: monitor_logger.h:41
This class helps collect and publish MonitorMessage pb to monitor topic. A module who wants to publis...
Definition: monitor_logger.h:51
Some string util functions.
#define DECLARE_SINGLETON(classname)
Definition: macros.h:52