24 #ifndef STORAGE_LOGGER_H 25 #define STORAGE_LOGGER_H 37 enum class LogLevel { DEBUG = 0, MILESTONE = 1, WARNING = 2, ERROR = 3 };
54 virtual bool test(
LogLevel log_level,
const std::string& component);
59 virtual void write(
LogLevel log_level,
const std::string& component,
const std::string& file,
60 int line,
const std::string&
function,
const std::string& content) = 0;
110 static bool is_any_active() {
return count > 0; }
virtual bool test(LogLevel log_level, const std::string &component)
Function to control whether a log line with level and component should be logged. ...
Logger * get_logger()
Get the current logger object.
void set_logger(Logger *logger)
Set the current logger object.
Logger * get_logfile_logger(const std::string &filename="/var/log/libstorage.log")
Returns a Logger that logs to the standard libstorage log file ("/var/log/libstorage.log") or to a given file.
The Logger class.
Definition: Logger.h:43
virtual void write(LogLevel log_level, const std::string &component, const std::string &file, int line, const std::string &function, const std::string &content)=0
Function to log a line.
LogLevel
Enum with log levels.
Definition: Logger.h:37
The storage namespace.
Definition: Actiongraph.h:38
Class to make some exceptions log-level DEBUG instead of WARNING.
Definition: Logger.h:99
Logger * get_stdout_logger()
Returns a Logger that logs to stdout.