summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarri Devender Rao <devenrao@in.ibm.com>2017-11-07 04:58:14 -0600
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2017-11-16 20:35:43 +0000
commit6088558429fbe5f723783b4220b6ac1c9096cde9 (patch)
tree3fb71a2014e4e65f3070711c3219442da042d308
parent67967f9a3f8e779d897a66cc6d559783911b2c14 (diff)
downloadphosphor-fan-presence-6088558429fbe5f723783b4220b6ac1c9096cde9.tar.gz
phosphor-fan-presence-6088558429fbe5f723783b4220b6ac1c9096cde9.zip
Fix up InternalFailure to include metadata
Scope is to add missing logs for InternalFailure errors Change-Id: I12c958127c1303fba0057914682e651457a0e547 Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
-rw-r--r--evdevpp/evdev.hpp15
-rw-r--r--sdevent/event.hpp23
-rw-r--r--sdevent/io.hpp6
-rw-r--r--sdevent/source.hpp11
4 files changed, 44 insertions, 11 deletions
diff --git a/evdevpp/evdev.hpp b/evdevpp/evdev.hpp
index 1861982..b0ba06e 100644
--- a/evdevpp/evdev.hpp
+++ b/evdevpp/evdev.hpp
@@ -36,6 +36,7 @@ using EvDev = std::unique_ptr<libevdev, EvDevDeleter>;
} // namespace details
+using namespace phosphor::logging;
/** @class EvDev
* @brief Provides C++ bindings to the libevdev C API.
*/
@@ -72,7 +73,10 @@ class EvDev
evdev.get(), type, code, &val);
if (!rc)
{
- phosphor::logging::elog<InternalFailure>();
+ log<level::ERR>("Error in call to libevdev_fetch_event_value",
+ entry("TYPE=%d", type),
+ entry("CODE=%d", code));
+ elog<InternalFailure>();
}
return val;
@@ -88,7 +92,9 @@ class EvDev
evdev.get(), LIBEVDEV_READ_FLAG_NORMAL, &ev);
if (rc < 0)
{
- phosphor::logging::elog<InternalFailure>();
+ log<level::ERR>("Error in call to libevdev_next_event",
+ entry("RC=%d", rc));
+ elog<InternalFailure>();
}
if (ev.type == EV_SYN && ev.code == SYN_REPORT)
@@ -118,7 +124,10 @@ inline auto newFromFD(int fd)
if (rc)
{
- phosphor::logging::elog<InternalFailure>();
+ log<level::ERR>("Error in call to libevdev_new_from_fd",
+ entry("RC=%d", rc),
+ entry("FD=%d", fd));
+ elog<InternalFailure>();
}
return EvDev(dev);
diff --git a/sdevent/event.hpp b/sdevent/event.hpp
index 53776ae..2058462 100644
--- a/sdevent/event.hpp
+++ b/sdevent/event.hpp
@@ -42,6 +42,8 @@ using Event = std::unique_ptr<sd_event, EventDeleter>;
} // namespace details
+using namespace phosphor::logging;
+
/** @class Event
* @brief Provides C++ bindings to the sd_event_* class functions.
*/
@@ -92,7 +94,9 @@ class Event
auto rc = sd_event_loop(evt.get());
if (rc < 0)
{
- phosphor::logging::elog<InternalFailure>();
+ log<level::ERR>("Error in call to sd_event_loop",
+ entry("RC=%d", rc));
+ elog<InternalFailure>();
}
}
@@ -102,7 +106,10 @@ class Event
auto rc = sd_event_exit(evt.get(), status);
if (rc < 0)
{
- phosphor::logging::elog<InternalFailure>();
+ log<level::ERR>("Error in call to sd_event_exit",
+ entry("RC=%d", rc),
+ entry("STATUS=%d", status));
+ elog<InternalFailure>();
}
}
@@ -113,7 +120,9 @@ class Event
auto rc = sd_event_get_exit_code(evt.get(), &status);
if (rc < 0)
{
- phosphor::logging::elog<InternalFailure>();
+ log<level::ERR>("Error in call to sd_event_get_exit_code",
+ entry("RC=%d", rc));
+ elog<InternalFailure>();
}
return status;
@@ -134,7 +143,9 @@ class Event
auto rc = sd_event_now(evt.get(), CLOCK_MONOTONIC, &usec);
if (rc < 0)
{
- phosphor::logging::elog<InternalFailure>();
+ log<level::ERR>("Error in call to sd_event_now",
+ entry("RC=%d", rc));
+ elog<InternalFailure>();
}
microseconds d(usec);
@@ -172,7 +183,9 @@ inline Event newDefault()
auto rc = sd_event_default(&e);
if (rc < 0)
{
- phosphor::logging::elog<InternalFailure>();
+ log<level::ERR>("Error in call to sd_event_default",
+ entry("RC=%d", rc));
+ elog<InternalFailure>();
}
return Event(e, std::false_type());
diff --git a/sdevent/io.hpp b/sdevent/io.hpp
index 93625a0..f511cf0 100644
--- a/sdevent/io.hpp
+++ b/sdevent/io.hpp
@@ -17,6 +17,7 @@ namespace event
namespace io
{
+using namespace phosphor::logging;
/** @class IO
* @brief Provides C++ bindings to the sd_event_source* io functions.
*/
@@ -67,7 +68,10 @@ class IO
cb.get());
if (rc < 0)
{
- phosphor::logging::elog<InternalFailure>();
+ log<level::ERR>("Error in call to sd_event_add_io",
+ entry("RC=%d", rc),
+ entry("FD=%d", fd));
+ elog<InternalFailure>();
}
src = decltype(src){source, std::false_type()};
diff --git a/sdevent/source.hpp b/sdevent/source.hpp
index be3a892..e90efd4 100644
--- a/sdevent/source.hpp
+++ b/sdevent/source.hpp
@@ -32,6 +32,8 @@ using source = std::unique_ptr<sd_event_source, SourceDeleter>;
} // namespace details
+using namespace phosphor::logging;
+
/** @class Source
* @brief Provides C++ bindings to the sd_event_source* functions.
*/
@@ -83,7 +85,9 @@ class Source
auto rc = sd_event_source_get_enabled(src.get(), &enabled);
if (rc < 0)
{
- phosphor::logging::elog<InternalFailure>();
+ log<level::ERR>("Error in call to sd_event_source_get_enabled",
+ entry("RC=%d", rc));
+ elog<InternalFailure>();
}
return enabled;
@@ -95,7 +99,10 @@ class Source
auto rc = sd_event_source_set_enabled(src.get(), enable);
if (rc < 0)
{
- phosphor::logging::elog<InternalFailure>();
+ log<level::ERR>("Error in call to sd_event_source_set_enabled",
+ entry("RC=%d", rc),
+ entry("ENABLE=%d", enable));
+ elog<InternalFailure>();
}
}
OpenPOWER on IntegriCloud