#ifndef ESEVERITYLEVEL_H #define ESEVERITYLEVEL_H #include /** * @class ESeverityLevel ESeverityLevel.h "include/ESeverityLevel.h" * @brief The ESeverity enumeration class * @date 07 Aug 2019 * * Contains the reference enumerator for * severity of log messages. */ class ESeverityLevel : public QObject { Q_OBJECT private: // Private constructor prevent the enumeration class from being instantiated explicit ESeverityLevel(QObject* parent = nullptr); public: /** * @brief The eSeverityLevel enum * Contains the reference enumerator for * severity levels. The severity of message * are defined to the syslog standard * severity levels as follows (from High to Low): * 0-Emergency * 1-Alert * 2-Critical * 3-Error * 4-Warning * 5-Notice * 6-Informational * 7-Debug * * For more information refer to https://en.wikipedia.org/wiki/Syslog */ enum eSeverityLevel : quint8 { /// 0-System is unusable /// A panic condition. Emergency, /// 1-Action must be taken immediately /// A condition tha should be corrected immediately, /// such as corrupted system databases. Alert, /// 2-Critical conditions /// Hard device errors. Critical, /// 3-Error conditions Error, /// 4-Warning conditions Warning, /// 5-Normal but significant conditions /// Conditions that are not error conditinos, /// but that may require special handling. Notice, /// 6-Informational messages Informational, /// 7-Debug-level messages /// Messages that contain information normally of /// use only when debugging a program. Debug, /// 8-Invalid Severity InvalidSeverity }; Q_ENUM(eSeverityLevel) /** * @brief enum to string converter * @param qtEnum Enumerator to be converted to the relevant string * @return String relevant to the input eLogId enumerator * @date 07 Aug 2019 * * Converts the eEseverityLevel enumerator to the relevant string */ static QString qtEnumToQString(const eSeverityLevel qtEnum) { return QString(QMetaEnum::fromType().valueToKey(qtEnum)); } /** * @brief string to enum converter * @param QString String to be converted to the relevane enum * @return Enum relevant to the input string * @date 26 Oct 2019 * * Converts the string to the relevant eEseverityLevel enumerator */ static quint8 QStringToQTEnum(const QString key) { return static_cast (QMetaEnum::fromType().keyToValue(key.toStdString().c_str())); } }; #endif // ESEVERITYLEVEL_H