Commit c60cc4ce6f8cf4745da28a8111768942b74a65e9

Authored by Steven
1 parent 13df26c3

added documentation

Showing 1 changed file with 131 additions and 0 deletions
src/log.h
... ... @@ -77,6 +77,11 @@ namespace log {
77 77 osdev::components::log::Log::debug(__FILE__, __LINE__, context, text); \
78 78 }
79 79  
  80 +/*!
  81 + * \brief The LogLevel enum
  82 + * Enumeration class dealing with LogLevels.
  83 + * Used to convert to syslog macro's.
  84 + */
80 85 enum class LogLevel
81 86 {
82 87 Emergency = 0,
... ... @@ -89,6 +94,11 @@ enum class LogLevel
89 94 Debug
90 95 };
91 96  
  97 +/*!
  98 + * \brief The LogMask enum
  99 + * Enumeration class dealing with LogMask.
  100 + * Used to convert to syslog macro's.
  101 + */
92 102 enum class LogMask
93 103 {
94 104 Mask = 0,
... ... @@ -102,21 +112,90 @@ enum class LogMask
102 112 class Log
103 113 {
104 114 public:
  115 + /**
  116 + * @brief Initialize the logging mechanism
  117 + * @param context - The main context
  118 + * @param logFile - Logfile if available
  119 + * @param logDepth - Initial log-depth
  120 + */
105 121 static void init( const std::string& context,
106 122 const std::string& logFile = std::string(),
107 123 LogLevel logDepth = LogLevel::Info );
108 124  
  125 + //! Shutdown the logging mechanism
109 126 static void terminate();
110 127  
  128 + /*!
  129 + * \brief Write to syslog
  130 + * \param priority - priority level [from debug up to emergency]
  131 + * \param message - The string to print
  132 + * \param context - The context name. default name is the name of the executable.
  133 + */
111 134 static void write( const int &priority, const std::string &message, const std::string &context = std::string() );
112 135  
  136 + /**
  137 + * @brief Log an emergency message in a category.
  138 + * @param file - Name of the source-file
  139 + * @param line - The line number in the source-file
  140 + * @param category - The category of the message.
  141 + * @param message - The string to print
  142 + */
113 143 static void emergency( const char* file, int line, const std::string& category, const std::string& message );
  144 + /**
  145 + * @brief Log an alert message in a category.
  146 + * @param file - Name of the source-file
  147 + * @param line - The line number in the source-file
  148 + * @param category - The category of the message.
  149 + * @param message - The string to print
  150 + */
114 151 static void alert ( const char* file, int line, const std::string& category, const std::string& message );
  152 + /**
  153 + * @brief Log a critical message in a category.
  154 + * @param file - Name of the source-file
  155 + * @param line - The line number in the source-file
  156 + * @param category - The category of the message.
  157 + * @param message - The string to print
  158 + */
115 159 static void critical ( const char* file, int line, const std::string& category, const std::string& message );
  160 + /**
  161 + * @brief Log an error message in a category.
  162 + * @param file - Name of the source-file
  163 + * @param line - The line number in the source-file
  164 + * @param category - The category of the message.
  165 + * @param message - The string to print
  166 + */
116 167 static void error ( const char* file, int line, const std::string& category, const std::string& message );
  168 + /**
  169 + * @brief Log a warning message in a category.
  170 + * @param file - Name of the source-file
  171 + * @param line - The line number in the source-file
  172 + * @param category - The category of the message.
  173 + * @param message - The string to print
  174 + */
117 175 static void warning ( const char* file, int line, const std::string& category, const std::string& message );
  176 + /**
  177 + * @brief Log a notice message in a category.
  178 + * @param file - Name of the source-file
  179 + * @param line - The line number in the source-file
  180 + * @param category - The category of the message.
  181 + * @param message - The string to print
  182 + */
118 183 static void notice ( const char* file, int line, const std::string& category, const std::string& message );
  184 + /**
  185 + * @brief Log an info message in a category.
  186 + * @param file - Name of the source-file
  187 + * @param line - The line number in the source-file
  188 + * @param category - The category of the message.
  189 + * @param message - The string to print
  190 + */
119 191 static void info ( const char* file, int line, const std::string& category, const std::string& message );
  192 + /**
  193 + * @brief Log a debug message in a category.
  194 + * @param file - Name of the source-file
  195 + * @param line - The line number in the source-file
  196 + * @param category - The category of the message.
  197 + * @param message - The string to print
  198 + */
120 199 static void debug ( const char* file, int line, const std::string& category, const std::string& message );
121 200  
122 201 /**
... ... @@ -131,18 +210,70 @@ public:
131 210 return s_logLevel;
132 211 }
133 212  
  213 + /*!
  214 + * \brief setMask update the current logMask
  215 + * \param logMask - Enum defining the logmask used.
  216 + */
134 217 static void setMask ( LogMask logMask ) { s_logMask = logMask; }
  218 + /*!
  219 + * \brief setLogLevel update the current logLevel
  220 + * \param logLevel - Enum defining the logLevel used, in combination with Mask.
  221 + */
135 222 static void setLogLevel( LogLevel logLevel ) { s_logLevel = logLevel; }
  223 + /*!
  224 + * \brief setContext update the current context
  225 + * \param context - String containing the new context name.
  226 + */
136 227 static void setContext ( std::string context ) { s_context = context; }
137 228  
138 229 protected:
  230 + /**
  231 + * @brief Log an emergency message in a category.
  232 + * @param category The category of the message.
  233 + * @param message The string to print.
  234 + */
139 235 static void emergency( const std::string& category, const std::string& message );
  236 + /**
  237 + * @brief Log an alert message in a category.
  238 + * @param category The category of the message.
  239 + * @param message The string to print.
  240 + */
140 241 static void alert ( const std::string& category, const std::string& message );
  242 + /**
  243 + * @brief Log a critical message in a category.
  244 + * @param category The category of the message.
  245 + * @param message The string to print.
  246 + */
141 247 static void critical ( const std::string& category, const std::string& message );
  248 + /**
  249 + * @brief Log an error message in a category.
  250 + * @param category The category of the message.
  251 + * @param message The string to print.
  252 + */
142 253 static void error ( const std::string& category, const std::string& message );
  254 + /**
  255 + * @brief Log a warning message in a category.
  256 + * @param category The category of the message.
  257 + * @param message The string to print.
  258 + */
143 259 static void warning ( const std::string& category, const std::string& message );
  260 + /**
  261 + * @brief Log a notice message in a category.
  262 + * @param category The category of the message.
  263 + * @param message The string to print.
  264 + */
144 265 static void notice ( const std::string& category, const std::string& message );
  266 + /**
  267 + * @brief Log an info message in a category.
  268 + * @param category The category of the message.
  269 + * @param message The string to print.
  270 + */
145 271 static void info ( const std::string& category, const std::string& message );
  272 + /**
  273 + * @brief Log an debug message in a category.
  274 + * @param category The category of the message.
  275 + * @param message The string to print.
  276 + */
146 277 static void debug ( const std::string& category, const std::string& message );
147 278  
148 279 /**
... ...