aboutsummaryrefslogtreecommitdiff
path: root/framework/Exceptions.h
diff options
context:
space:
mode:
authorMoritz Pflanzer <moritz.pflanzer@arm.com>2017-07-24 15:52:54 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-09-17 14:16:42 +0100
commit2ac5040c9b21734610b51b232ddac5a9067aa2c2 (patch)
tree6904b4c587cf0c5ebab4f8b05113bc8eb397b948 /framework/Exceptions.h
parentbf234e0c5d2af80f89fffcd963e5e2c455bcf3f1 (diff)
downloadComputeLibrary-2ac5040c9b21734610b51b232ddac5a9067aa2c2.tar.gz
COMPMID-415: Add log level
Change-Id: I93f49198ab2c32f52b4723a0624d588683a92451 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/81446 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'framework/Exceptions.h')
-rw-r--r--framework/Exceptions.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/framework/Exceptions.h b/framework/Exceptions.h
index 4e42971cd0..de617602dc 100644
--- a/framework/Exceptions.h
+++ b/framework/Exceptions.h
@@ -24,7 +24,10 @@
#ifndef ARM_COMPUTE_TEST_EXCEPTIONS
#define ARM_COMPUTE_TEST_EXCEPTIONS
+#include <istream>
+#include <ostream>
#include <stdexcept>
+#include <string>
namespace arm_compute
{
@@ -32,11 +35,55 @@ namespace test
{
namespace framework
{
+/** Severity of the information.
+ *
+ * Each category includes the ones above it.
+ *
+ * NONE == Only for filtering. Not used to tag information.
+ * CONFIG == Configuration info.
+ * TESTS == Information about the tests.
+ * ERRORS == Violated assertions/expectations.
+ * DEBUG == More violated assertions/expectations.
+ * MEASUREMENTS == Information about measurements.
+ * ALL == Only for filtering. Not used to tag information.
+ */
+enum class LogLevel
+{
+ NONE,
+ CONFIG,
+ TESTS,
+ ERRORS,
+ DEBUG,
+ MEASUREMENTS,
+ ALL,
+};
+
+LogLevel log_level_from_name(const std::string &name);
+::std::istream &operator>>(::std::istream &stream, LogLevel &level);
+::std::ostream &operator<<(::std::ostream &stream, LogLevel level);
+std::string to_string(LogLevel level);
+
/** Error class for failures during test execution. */
class TestError : public std::runtime_error
{
public:
using std::runtime_error::runtime_error;
+
+ /** Construct error with severity.
+ *
+ * @param[in] msg Error message.
+ * @param[in] level Severity level.
+ */
+ TestError(const std::string &msg, LogLevel level);
+
+ /** Severity of the error.
+ *
+ * @return Severity.
+ */
+ LogLevel level() const;
+
+private:
+ LogLevel _level{ LogLevel::ERRORS };
};
} // namespace framework
} // namespace test