diff options
author | Marcus Müller <mmueller@gnuradio.org> | 2020-04-11 00:43:39 +0200 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2020-04-13 15:55:41 +0200 |
commit | 0f88db1ef0569bf6fcd5e9c843da38d487a6f54b (patch) | |
tree | 4c9827377c0e98fe223f39edb0c84c8a49c199e9 /gnuradio-runtime/lib/vmcircbuf_prefs.cc | |
parent | ec8a92846a388cb0d2982822ea1961910cd552f8 (diff) |
runtime: replace stderr logging by calls to GR's logging facilties
Diffstat (limited to 'gnuradio-runtime/lib/vmcircbuf_prefs.cc')
-rw-r--r-- | gnuradio-runtime/lib/vmcircbuf_prefs.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/gnuradio-runtime/lib/vmcircbuf_prefs.cc b/gnuradio-runtime/lib/vmcircbuf_prefs.cc index 96f37b44a7..ac77e69f57 100644 --- a/gnuradio-runtime/lib/vmcircbuf_prefs.cc +++ b/gnuradio-runtime/lib/vmcircbuf_prefs.cc @@ -56,8 +56,13 @@ int vmcircbuf_prefs::get(const char* key, char* value, int value_size) gr::thread::scoped_lock guard(s_vm_mutex); FILE* fp = fopen(pathname(key).c_str(), "r"); + + gr::logger_ptr logger, debug_logger; + gr::configure_default_loggers(logger, debug_logger, "vmcircbuf_prefs::get"); + if (fp == 0) { - perror(pathname(key).c_str()); + GR_LOG_ERROR(logger, + boost::format("%s: %s") % pathname(key).c_str() % strerror(errno)); return 0; } @@ -65,7 +70,9 @@ int vmcircbuf_prefs::get(const char* key, char* value, int value_size) value[ret] = '\0'; if (ret == 0 && !feof(fp)) { if (ferror(fp) != 0) { - perror(pathname(key).c_str()); + GR_LOG_ERROR(logger, + boost::format("%s: %s") % pathname(key).c_str() % + strerror(errno)); fclose(fp); return -1; } @@ -79,17 +86,22 @@ void vmcircbuf_prefs::set(const char* key, const char* value) gr::thread::scoped_lock guard(s_vm_mutex); ensure_dir_path(); + gr::logger_ptr logger, debug_logger; + gr::configure_default_loggers(logger, debug_logger, "vmcircbuf_prefs::set"); FILE* fp = fopen(pathname(key).c_str(), "w"); if (fp == 0) { - perror(pathname(key).c_str()); + GR_LOG_ERROR(logger, + boost::format("%s: %s") % pathname(key).c_str() % strerror(errno)); return; } size_t ret = fwrite(value, 1, strlen(value), fp); if (ret == 0) { if (ferror(fp) != 0) { - perror(pathname(key).c_str()); + GR_LOG_ERROR(logger, + boost::format("%s: %s") % pathname(key).c_str() % + strerror(errno)); fclose(fp); return; } |