diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-04-22 13:57:41 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-04-22 13:57:41 +0200 |
commit | f0973849c4df5740ffb241a21fc08398fa741a7e (patch) | |
tree | d4adca2a6a70d6bd44adf60f3a774d29b968d5b4 /CAN-binder/low-can-binding/utils | |
parent | 98766025818904420be6088e60453b885a05e9d7 (diff) |
Improve logging messages
Added for all log messages function name at beginning using __FUNCTION__ macro.
Change-Id: Ia0f476ca81b9f79c6d49b425c0520894c59797ea
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/utils')
-rw-r--r-- | CAN-binder/low-can-binding/utils/config-parser.cpp | 4 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/utils/signals.cpp | 7 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/utils/socket.cpp | 8 |
3 files changed, 11 insertions, 8 deletions
diff --git a/CAN-binder/low-can-binding/utils/config-parser.cpp b/CAN-binder/low-can-binding/utils/config-parser.cpp index dd500d30..c2528e0c 100644 --- a/CAN-binder/low-can-binding/utils/config-parser.cpp +++ b/CAN-binder/low-can-binding/utils/config-parser.cpp @@ -34,10 +34,10 @@ namespace utils { if (config_content_.size() <= 0) { - ERROR(binder_interface, "read_conf: Can't load the INI config file."); + ERROR(binder_interface, "%s: Can't load the INI config file.", __FUNCTION__); return false; } - DEBUG(binder_interface, "read_conf: Configuration file parsed"); + DEBUG(binder_interface, "%s: Configuration file parsed", __FUNCTION__); return true; } diff --git a/CAN-binder/low-can-binding/utils/signals.cpp b/CAN-binder/low-can-binding/utils/signals.cpp index 219dfd40..b75eb2c5 100644 --- a/CAN-binder/low-can-binding/utils/signals.cpp +++ b/CAN-binder/low-can-binding/utils/signals.cpp @@ -19,6 +19,9 @@ namespace utils { + signals_manager_t::signals_manager_t() + {} + /// @brief Return singleton instance of configuration object. signals_manager_t& signals_manager_t::instance() { @@ -65,10 +68,10 @@ namespace utils lookup_signals_by_id(key.numeric_value, configuration_t::instance().get_diagnostic_messages(), sf.diagnostic_messages); break; default: - ERROR(binder_interface, "find_signals: wrong openxc_DynamicField specified. Use openxc_DynamicField_Type_NUM or openxc_DynamicField_Type_STRING type only."); + ERROR(binder_interface, "%s: wrong openxc_DynamicField specified. Use openxc_DynamicField_Type_NUM or openxc_DynamicField_Type_STRING type only.", __FUNCTION__); break; } - DEBUG(binder_interface, "find_signals: Found %d signal(s)", (int)(sf.can_signals.size() + sf.diagnostic_messages.size())); + DEBUG(binder_interface, "%s: Found %d signal(s)", __FUNCTION__, (int)(sf.can_signals.size() + sf.diagnostic_messages.size())); return sf; } }
\ No newline at end of file diff --git a/CAN-binder/low-can-binding/utils/socket.cpp b/CAN-binder/low-can-binding/utils/socket.cpp index e166b8c9..01937ed4 100644 --- a/CAN-binder/low-can-binding/utils/socket.cpp +++ b/CAN-binder/low-can-binding/utils/socket.cpp @@ -116,10 +116,10 @@ namespace utils // Attempts to open a socket to CAN bus ::strcpy(ifr.ifr_name, device_name.c_str()); - DEBUG(binder_interface, "open: ifr_name is : %s", ifr.ifr_name); + DEBUG(binder_interface, "%s: ifr_name is : %s", __FUNCTION__, ifr.ifr_name); if(::ioctl(socket_, SIOCGIFINDEX, &ifr) < 0) { - ERROR(binder_interface, "open: ioctl failed. Error was : %s", strerror(errno)); + ERROR(binder_interface, "%s: ioctl failed. Error was : %s", __FUNCTION__, strerror(errno)); close(); } else @@ -129,13 +129,13 @@ namespace utils if(bcm && connect((struct sockaddr *)&txAddress_, sizeof(txAddress_)) < 0) { - ERROR(binder_interface, "Connect failed. %s", strerror(errno)); + ERROR(binder_interface, "%s: Connect failed. %s", __FUNCTION__, strerror(errno)); close(); } // It's a RAW socket request, bind it to txAddress else if(bind((struct sockaddr *)&txAddress_, sizeof(txAddress_)) < 0) { - ERROR(binder_interface, "Bind failed. %s", strerror(errno)); + ERROR(binder_interface, "%s: Bind failed. %s", __FUNCTION__, strerror(errno)); close(); } } |