summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/logger.cc
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2014-06-29 22:01:02 -0400
committerTom Rondeau <tom@trondeau.com>2014-06-29 22:01:02 -0400
commit0ae33fc67a7655b63a6384a1898319b7cc2c5bf6 (patch)
tree59e8d2b31b45e859716eaa73fc94f32162302735 /gnuradio-runtime/lib/logger.cc
parentdf8bd0bc31693a04b0096743d451c0c36cc7b297 (diff)
runtime: fix a memory leak in the logger when restarting a flowgraph due to adding new appenders to the logger. Now we clear them and set a
This adds a set of "set" functions to set a new appender. We can always add additional loggers using the old "add" functions.
Diffstat (limited to 'gnuradio-runtime/lib/logger.cc')
-rw-r--r--gnuradio-runtime/lib/logger.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/gnuradio-runtime/lib/logger.cc b/gnuradio-runtime/lib/logger.cc
index a7e4a25a40..c11f384cc6 100644
--- a/gnuradio-runtime/lib/logger.cc
+++ b/gnuradio-runtime/lib/logger.cc
@@ -254,6 +254,13 @@ namespace gr {
}
void
+ logger_set_console_appender(logger_ptr logger, std::string target, std::string pattern)
+ {
+ logger->removeAllAppenders();
+ logger_add_console_appender(logger, target, pattern);
+ }
+
+ void
logger_add_file_appender(logger_ptr logger, std::string filename,
bool append, std::string pattern)
{
@@ -267,6 +274,14 @@ namespace gr {
}
void
+ logger_set_file_appender(logger_ptr logger, std::string filename,
+ bool append, std::string pattern)
+ {
+ logger->removeAllAppenders();
+ logger_add_file_appender(logger, filename, append, pattern);
+ }
+
+ void
logger_add_rollingfile_appender(logger_ptr logger, std::string filename,
size_t filesize, int bkup_index, bool append,
mode_t mode, std::string pattern)