@@ -122,27 +122,43 @@ namespace logging {
122122 * greater than or equal to the logging level within that subsystem, the log
123123 * will be printed.
124124 *
125- * The convience levels, @ref Verbose and @ref Quiet are the primary user facing
126- * options. @ref Quiet turns off logging and @ref Verbose is the default and
127- * shows things that are generally useful. These names exist such that logging
128- * levels can be added and removed without users needed to change what they set
129- * logging to.
125+ * The convenience levels, @ref Verbose, @ref Default and @ref Quiet are the primary user facing
126+ * options. @ref Quiet turns off logging for all but errors, @ref Default is the default and
127+ * shows warnings and errors, while @ref Verbose gives debug messages along with warnings and
128+ * errors. These names exist such that logging levels can be added and removed
129+ * without users needing to change what they set logging to.
130130 */
131131enum class LoggingLevel : uint8_t {
132+ /* *
133+ * Logging level to be used to provide in depth information about a process
134+ * and its result.
135+ */
132136 VeryVerbose,
137+
138+ /* *
139+ * Logging level to be used to specify the result of some process.
140+ */
133141 Debug,
142+ /* *
143+ * Logging level to be used to denote that some process has yielded a result
144+ * that may not be appropriate or expected.
145+ */
134146 Warning,
147+ /* *
148+ * Logging level to be used to denote that some process has failed.
149+ */
135150 Error,
136151
137152 /* *
138- * The default logging level. Enables all logging except for the most verbose
139- * statements. Habitat-Sim will be fairly verbose in this setting, but not
140- * overly so.
141- *
142- * Note: If you add another level that is lower priority than Debug but should
143- * be on by default or Debug is removed/renamed, this will need to be updated.
153+ * Enables all logging except for the most verbose statements. Habitat-Sim
154+ * will be fairly verbose in this setting, but not overly so.
144155 */
145156 Verbose = Debug,
157+ /* *
158+ * The default logging level. Enables all warning and error messages but hides
159+ * debug and verbose messages.
160+ */
161+ Default = Warning,
146162 /* *
147163 * Turns of all non-critical logging messages, i.e. those that indicate that
148164 * something has gone wrong.
@@ -165,7 +181,7 @@ LoggingLevel levelFromName(Corrade::Containers::StringView name);
165181class LoggingContext {
166182 public:
167183 constexpr static const char * LOGGING_ENV_VAR_NAME = " HABITAT_SIM_LOG" ;
168- constexpr static LoggingLevel DEFAULT_LEVEL = LoggingLevel::Verbose ;
184+ constexpr static LoggingLevel DEFAULT_LEVEL = LoggingLevel::Default ;
169185
170186 /* *
171187 * @brief Convenience constructor that grabs the configuration string from the
@@ -246,6 +262,7 @@ bool isLevelEnabled(Subsystem subsystem, LoggingLevel level);
246262 * subsystem/namespace, file, line number and function name
247263 */
248264Corrade::Containers::String buildMessagePrefix (Subsystem subsystem,
265+ const std::string& msgLevel,
249266 const std::string& filename,
250267 const std::string& function,
251268 int line);
@@ -304,10 +321,10 @@ class LogMessageVoidify {
304321
305322// This ends with a nospace since the space is baked in to subsystemPrefix for
306323// the case that the logger was created with a nospace flag.
307- #define ESP_SUBSYS_LOG_IF (subsystem, level, output ) \
308- ESP_LOG_IF (esp::logging::isLevelEnabled((subsystem), (level)), (output)) \
309- << esp::logging::buildMessagePrefix((subsystem), (__FILE__ ), \
310- (__FUNCTION__), (__LINE__)) \
324+ #define ESP_SUBSYS_LOG_IF (subsystem, level, output, levelMsg ) \
325+ ESP_LOG_IF (esp::logging::isLevelEnabled((subsystem), (level)), (output)) \
326+ << esp::logging::buildMessagePrefix((subsystem), (levelMsg ), (__FILE__), \
327+ (__FUNCTION__), (__LINE__)) \
311328 << Corrade::Utility::Debug::nospace
312329
313330#define ESP_LOG_LEVEL_ENABLED (level ) \
@@ -320,25 +337,26 @@ class LogMessageVoidify {
320337 ESP_SUBSYS_LOG_IF ( \
321338 espLoggingSubsystem (), esp::logging::LoggingLevel::VeryVerbose, \
322339 (Corrade::Utility::Debug{Corrade::Utility::Debug::defaultOutput (), \
323- __VA_ARGS__}))
340+ __VA_ARGS__}), \
341+ "Verbose")
324342/* *
325343 * @brief Debug level logging macro.
326344 */
327345#define ESP_DEBUG (...) \
328346 ESP_SUBSYS_LOG_IF (espLoggingSubsystem(), esp::logging::LoggingLevel::Debug, \
329- Corrade::Utility::Debug{__VA_ARGS__})
347+ Corrade::Utility::Debug{__VA_ARGS__}, " Debug " )
330348/* *
331349 * @brief Warning level logging macro.
332350 */
333351#define ESP_WARNING (...) \
334352 ESP_SUBSYS_LOG_IF (espLoggingSubsystem(), \
335353 esp::logging::LoggingLevel::Warning, \
336- Corrade::Utility::Warning{__VA_ARGS__})
354+ Corrade::Utility::Warning{__VA_ARGS__}, " Warning " )
337355/* *
338356 * @brief Error level logging macro.
339357 */
340358#define ESP_ERROR (...) \
341359 ESP_SUBSYS_LOG_IF (espLoggingSubsystem(), esp::logging::LoggingLevel::Error, \
342- Corrade::Utility::Error{__VA_ARGS__})
360+ Corrade::Utility::Error{__VA_ARGS__}, " Error " )
343361
344362#endif // ESP_CORE_LOGGING_H_
0 commit comments