carl  24.04
Computer ARithmetic Library
LogLevel.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <ostream>
4 
5 namespace carl::logging {
6 
7 /**
8  * Indicated which log messages should be forwarded to some sink.
9  *
10  * All messages which have a level that is equal or greater than the specified value will be forwarded.
11  */
12 enum class LogLevel {
13  /// All log messages.
14  LVL_ALL,
15  /// Finer-grained informational events than the DEBUG.
16  LVL_TRACE,
17  /// Fine-grained informational events that are most useful to debug an application.
18  LVL_DEBUG,
19  /// Highlight the progress of the application at coarse-grained level.
20  LVL_INFO,
21  /// Potentially harmful situations or undesired states.
22  LVL_WARN,
23  /// Error events that might still allow the application to continue running.
24  LVL_ERROR,
25  /// Severe error events that will presumably lead the application to terminate.
26  LVL_FATAL,
27  /// No messages.
28  LVL_OFF,
29  /// Default log level.
31 };
32 
33 /**
34  * Streaming operator for LogLevel.
35  * @param os Output stream.
36  * @param level LogLevel.
37  * @return os.
38  */
39 inline std::ostream& operator<<(std::ostream& os, LogLevel level) {
40  switch (level) {
41  case LogLevel::LVL_ALL: return os << "ALL ";
42  case LogLevel::LVL_TRACE: return os << "TRACE";
43  case LogLevel::LVL_DEBUG: return os << "DEBUG";
44  case LogLevel::LVL_INFO: return os << "INFO ";
45  case LogLevel::LVL_WARN: return os << "WARN ";
46  case LogLevel::LVL_ERROR: return os << "ERROR";
47  case LogLevel::LVL_FATAL: return os << "FATAL";
48  case LogLevel::LVL_OFF: return os << "OFF ";
49  }
50  return os;
51 }
52 
53 }
Contains a custom logging facility.
Definition: carl-logging.cpp:6
std::ostream & operator<<(std::ostream &os, LogLevel level)
Streaming operator for LogLevel.
Definition: LogLevel.h:39
LogLevel
Indicated which log messages should be forwarded to some sink.
Definition: LogLevel.h:12
@ LVL_DEBUG
Fine-grained informational events that are most useful to debug an application.
@ LVL_ERROR
Error events that might still allow the application to continue running.
@ LVL_WARN
Potentially harmful situations or undesired states.
@ LVL_FATAL
Severe error events that will presumably lead the application to terminate.
@ LVL_INFO
Highlight the progress of the application at coarse-grained level.
@ LVL_DEFAULT
Default log level.
@ LVL_TRACE
Finer-grained informational events than the DEBUG.
@ LVL_ALL
All log messages.