-
Notifications
You must be signed in to change notification settings - Fork 110
logging
Takatoshi Kondo edited this page Aug 20, 2020
·
6 revisions
mqtt_cpp outputs log messages using Boost.Log.
By default, mqtt_cpp use the default Boost.Log settings. Custom setup is usually convenient.
mqtt_cpp provides a typical logging setting.
First, include the following file:
#include <mqtt/setup_log.hpp>
Next, call setup_log().
int main() {
...
mqtt::setup_log(
{
{ "mqtt_api", mqtt::severity_level::trace },
{ "mqtt_cb", mqtt::severity_level::debug },
}
);
...
The setup takes std::map<mqtt::channel, mqtt::severity_level>
. You can set the threshold severity_level by each channel.
You can also call setup_log() like as follows:
int main() {
...
mqtt::setup_log(
mqtt::severity_level::warning
);
...
The threshold is applied for all channels.
Channel describes what kind of message.
channel | description |
---|---|
mqtt_api | API is called |
mqtt_cb | event is occurred |
High priority Low priority
fatal, error, warning, info, debug, trace
- Requirements
- Config
- Tutorial
- Authentication and Authorization
- Advanced topics
- Examples
- API Reference
- Versioning Policy
- How to contribute