16 #include <aws/core/Aws.h> 17 #include <aws/core/utils/logging/LogMacros.h> 22 #include <rosgraph_msgs/Log.h> 24 #include <unordered_set> 31 int main(
int argc,
char ** argv)
33 Aws::SDKOptions options;
34 Aws::InitAPI(options);
35 Aws::Utils::Logging::InitializeAWSLogging(
36 Aws::MakeShared<Aws::Utils::Logging::AWSROSLogger>(
kNodeName));
38 AWS_LOGSTREAM_INFO(__func__,
"Starting " <<
kNodeName <<
"...");
41 double publish_frequency;
42 std::string log_group;
43 std::string log_stream;
44 bool subscribe_to_rosout;
45 Aws::SDKOptions sdk_options;
51 std::shared_ptr<Aws::Client::ParameterReaderInterface> parameter_reader =
52 std::make_shared<Aws::Client::Ros1NodeParameterReader>();
69 cloudwatch_logger.
Initialize(log_group, log_stream, config, sdk_options, cloudwatch_options);
75 cloudwatch_logger.
start();
78 boost::function<void(const rosgraph_msgs::Log::ConstPtr &)> callback;
79 callback = [&cloudwatch_logger](
const rosgraph_msgs::Log::ConstPtr & log_msg) ->
void {
84 std::vector<ros::Subscriber> subscriptions;
86 AWS_LOGSTREAM_INFO(__func__,
"Initialized " <<
kNodeName <<
".");
93 if (!publish_when_size_reached) {
102 AWS_LOGSTREAM_INFO(__func__,
"Shutting down " <<
kNodeName <<
".");
104 Aws::Utils::Logging::ShutdownAWSLogging();
106 Aws::ShutdownAPI(options);
Aws::AwsError ReadIgnoreNodesSet(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, std::unordered_set< std::string > &ignore_nodes)
Aws::DataFlow::UploaderOptions uploader_options
Timer createTimer(Rate r, Handler h, Obj o, bool oneshot=false, bool autostart=true) const
size_t batch_trigger_publish_size
int main(int argc, char **argv)
bool checkIfOnline(std_srvs::Trigger::Request &request, std_srvs::Trigger::Response &response)
Aws::AwsError ReadSubscribeToRosout(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, bool &subscribe_to_rosout)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
Aws::AwsError ReadMinLogVerbosity(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, int8_t &min_log_verbosity)
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
Aws::AwsError ReadPublishFrequency(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, double &publish_frequency)
Aws::AwsError ReadSubscriberList(bool subscribe_to_rosout, const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, const boost::function< void(const rosgraph_msgs::Log::ConstPtr &)> &callback, ros::NodeHandle &nh, std::vector< ros::Subscriber > &subscriptions)
void TriggerLogPublisher(const ros::TimerEvent &)
Trigger the log manager to call its Service function to publish logs to cloudwatch periodically...
void RecordLogs(const rosgraph_msgs::Log::ConstPtr &log_msg)
Emits RecordLog using the log manager.
static constexpr UploaderOptions kDefaultUploaderOptions
std::unordered_set< std::string > ignore_nodes
Aws::AwsError ReadLogStream(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, std::string &log_stream)
Aws::AwsError ReadPublishTopicNames(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, bool &publish_topic_names)
void Initialize(const std::string &log_group, const std::string &log_stream, const Aws::Client::ClientConfiguration &config, Aws::SDKOptions &sdk_options, const Aws::CloudWatchLogs::CloudWatchOptions &cloudwatch_options, const std::shared_ptr< LogServiceFactory > &log_service_factory=std::make_shared< LogServiceFactory >())
Reads creds, region, and SDK option to configure log manager.
Aws::AwsError ReadLogGroup(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, std::string &log_group)
ClientConfiguration GetClientConfiguration(const std::string &ros_version_override="")
void ReadCloudWatchOptions(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, Aws::CloudWatchLogs::CloudWatchOptions &cloudwatch_options)
ROSCPP_DECL void shutdown()
constexpr char kNodeName[]