Added libLogger's documentation 04/44604/3
authorJan Olszak <j.olszak@samsung.com>
Thu, 23 Jul 2015 12:28:21 +0000 (14:28 +0200)
committerJan Olszak <j.olszak@samsung.com>
Thu, 23 Jul 2015 14:01:09 +0000 (07:01 -0700)
[Feature]       N/A
[Cause]         N/A
[Solution]      N/A
[Verification]  ./generate_documentation.sh and verify

Change-Id: I53a75f358e0e9182f51334544cb5da9722182cf9

doc/doxygen.cfg
libs/logger/backend.hpp
libs/logger/level.hpp
libs/logger/logger-scope.hpp
libs/logger/logger.hpp

index 3373847..8800673 100644 (file)
@@ -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
index 99b0c49..2866fbc 100644 (file)
@@ -32,7 +32,8 @@
 namespace logger {
 
 /**
- * Abstract class for logger
+ * @brief Abstract class for logger backends
+ * @ingroup libLogger
  */
 class LogBackend {
 public:
index 7902301..fd33343 100644 (file)
 
 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
 };
 
 /**
index cefd912..41a99bf 100644 (file)
@@ -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)
index 3a0dee4..328bd05 100644 (file)
 
 /**
  * @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