From: Jan Olszak Date: Thu, 23 Jul 2015 12:28:21 +0000 (+0200) Subject: Added libLogger's documentation X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fsecurity%2Fvasum.git;a=commitdiff_plain;h=1899a99c617d097cee2139003de16896ca78e66c Added libLogger's documentation [Feature] N/A [Cause] N/A [Solution] N/A [Verification] ./generate_documentation.sh and verify Change-Id: I53a75f358e0e9182f51334544cb5da9722182cf9 --- diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg index 3373847..8800673 100644 --- a/doc/doxygen.cfg +++ b/doc/doxygen.cfg @@ -747,6 +747,7 @@ INPUT = ../common \ ../client \ ../server \ ../cli \ + ../libs \ mainpage.md # This tag can be used to specify the character encoding of the source files @@ -896,7 +897,7 @@ USE_MDFILE_AS_MAINPAGE = # also VERBATIM_HEADERS is set to NO. # The default value is: NO. -SOURCE_BROWSER = YES +SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body of functions, # classes and enums directly into the documentation. @@ -915,13 +916,13 @@ STRIP_CODE_COMMENTS = YES # function all documented functions referencing it will be listed. # The default value is: NO. -REFERENCED_BY_RELATION = YES +REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES then for each documented function # all documented entities called/used by that function will be listed. # The default value is: NO. -REFERENCES_RELATION = YES +REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set # to YES, then the hyperlinks from functions in REFERENCES_RELATION and diff --git a/libs/logger/backend.hpp b/libs/logger/backend.hpp index 99b0c49..2866fbc 100644 --- a/libs/logger/backend.hpp +++ b/libs/logger/backend.hpp @@ -32,7 +32,8 @@ namespace logger { /** - * Abstract class for logger + * @brief Abstract class for logger backends + * @ingroup libLogger */ class LogBackend { public: diff --git a/libs/logger/level.hpp b/libs/logger/level.hpp index 7902301..fd33343 100644 --- a/libs/logger/level.hpp +++ b/libs/logger/level.hpp @@ -29,13 +29,17 @@ namespace logger { +/** + * @brief Available log levels + * @ingroup libLogger + */ enum class LogLevel { - TRACE, - DEBUG, - INFO, - WARN, - ERROR, - HELP + TRACE, ///< Most detailed log level + DEBUG, ///< Debug logs + INFO, ///< Information + WARN, ///< Warnings + ERROR, ///< Errors + HELP ///< Helper logs }; /** diff --git a/libs/logger/logger-scope.hpp b/libs/logger/logger-scope.hpp index cefd912..41a99bf 100644 --- a/libs/logger/logger-scope.hpp +++ b/libs/logger/logger-scope.hpp @@ -70,7 +70,10 @@ private: } // namespace logger -// macro to automatically create LoggerScope object +/** + * @brief Automatically create LoggerScope object which logs at the construction and destruction + * @ingroup libLogger + */ #define LOGS(MSG) logger::LoggerScope logScopeObj(__FILE__, __LINE__, __func__, \ logger::SStreamWrapper() << MSG, \ PROJECT_SOURCE_DIR) diff --git a/libs/logger/logger.hpp b/libs/logger/logger.hpp index 3a0dee4..328bd05 100644 --- a/libs/logger/logger.hpp +++ b/libs/logger/logger.hpp @@ -18,10 +18,44 @@ /** * @file - * @author Jan Olszak (j.olszak@samsung.com) - * @brief Logger + * @author Jan Olszak (j.olszak@samsung.com) + * @defgroup libLogger libLogger + * @brief C++ library for handling logging. + * + * There are few backends implemented and it's possible to create your own by inheriting after the @ref logger::LogBackend interface. + * + * Example usage: + * @code + * using namespace logger; + * + * // Set minimal logging level + * Logger::setLogLevel("TRACE"); + * + * + * // Set one of the possible backends: + * Logger::setLogBackend(new NullLogger()); + * Logger::setLogBackend(new SystemdJournalBackend()); + * Logger::setLogBackend(new FileBackend("/tmp/logs.txt")); + * Logger::setLogBackend(new SyslogBackend()); + * Logger::setLogBackend(new StderrBackend()); + * + * + * // All logs should be visible: + * LOGE("Error"); + * LOGW("Warning"); + * LOGI("Information"); + * LOGD("Debug"); + * LOGT("Trace"); + * LOGH("Helper"); + * + * { + * LOGS("Scope"); + * } + * + * @endcode */ + #ifndef COMMON_LOGGER_LOGGER_HPP #define COMMON_LOGGER_LOGGER_HPP @@ -57,6 +91,8 @@ public: } // namespace logger +/*@{*/ +/// @brief Generic logging macro #define LOG(SEVERITY, MESSAGE) \ do { \ if (logger::Logger::getLogLevel() <= logger::LogLevel::SEVERITY) { \ @@ -71,11 +107,24 @@ public: } \ } while (0) + +/// Logging errors #define LOGE(MESSAGE) LOG(ERROR, MESSAGE) + +/// Logging warnings #define LOGW(MESSAGE) LOG(WARN, MESSAGE) + +/// Logging information #define LOGI(MESSAGE) LOG(INFO, MESSAGE) + +/// Logging debug information #define LOGD(MESSAGE) LOG(DEBUG, MESSAGE) + +/// Logging helper information (for debugging purposes) #define LOGH(MESSAGE) LOG(HELP, MESSAGE) + +/// Logging tracing information #define LOGT(MESSAGE) LOG(TRACE, MESSAGE) #endif // COMMON_LOGGER_LOGGER_HPP +/*@}*/ \ No newline at end of file