From: Francis Deslauriers Date: Mon, 22 Apr 2019 20:21:07 +0000 (-0400) Subject: sink.text.pretty: print inactivity msg handling with BT_LOGD_STR X-Git-Tag: v2.0.0-pre5~71 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=1e3400b8572abdb55c6f0416e7c47d13fb715037 sink.text.pretty: print inactivity msg handling with BT_LOGD_STR Instead of printing that the component received a message iterator inactivity message to standard error; log this information with BT_LOGD(). Signed-off-by: Francis Deslauriers --- diff --git a/plugins/text/pretty/Makefile.am b/plugins/text/pretty/Makefile.am index 7d990aa0..7af0f29d 100644 --- a/plugins/text/pretty/Makefile.am +++ b/plugins/text/pretty/Makefile.am @@ -4,6 +4,8 @@ noinst_LTLIBRARIES = libbabeltrace-plugin-text-pretty-cc.la # ctf-text plugin libbabeltrace_plugin_text_pretty_cc_la_SOURCES = \ + logging.c \ + logging.h \ pretty.c \ - print.c \ - pretty.h + pretty.h \ + print.c diff --git a/plugins/text/pretty/logging.c b/plugins/text/pretty/logging.c new file mode 100644 index 00000000..42595e79 --- /dev/null +++ b/plugins/text/pretty/logging.c @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2019 Francis Deslauriers + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#define BT_LOG_OUTPUT_LEVEL bt_plugin_text_pretty_log_level +#include + +BT_LOG_INIT_LOG_LEVEL(bt_plugin_text_pretty_log_level, + "BABELTRACE_SINK_TEXT_PRETTY_LOG_LEVEL"); diff --git a/plugins/text/pretty/logging.h b/plugins/text/pretty/logging.h new file mode 100644 index 00000000..417ca6a0 --- /dev/null +++ b/plugins/text/pretty/logging.h @@ -0,0 +1,31 @@ +#ifndef PLUGINS_TEXT_PRETTY_LOG_LEVEL +#define PLUGINS_TEXT_PRETTY_LOG_LEVEL + +/* + * Copyright (c) 2019 Francis Deslauriers + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#define BT_LOG_OUTPUT_LEVEL bt_plugin_text_pretty_log_level +#include + +BT_LOG_LEVEL_EXTERN_SYMBOL(bt_plugin_text_pretty_log_level); + +#endif /* PLUGINS_TEXT_PRETTY_LOG_LEVEL */ diff --git a/plugins/text/pretty/pretty.c b/plugins/text/pretty/pretty.c index 63a6c879..6b6e3cd5 100644 --- a/plugins/text/pretty/pretty.c +++ b/plugins/text/pretty/pretty.c @@ -23,6 +23,9 @@ * SOFTWARE. */ +#define BT_LOG_TAG "PLUGIN-TEXT-PRETTY-SINK" +#include "logging.h" + #include #include #include @@ -139,7 +142,7 @@ bt_self_component_status handle_message( } break; case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY: - fprintf(stderr, "Message iterator inactivity message\n"); + BT_LOGD_STR("Message iterator inactivity message."); break; case BT_MESSAGE_TYPE_DISCARDED_EVENTS: case BT_MESSAGE_TYPE_DISCARDED_PACKETS: