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; }
The Logger class.
Definition: Logger.h:44
virtual bool test(LogLevel log_level, const std::string &component)
Function to control whether a log line with level and component should be logged.
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.
Class to make some exceptions log-level DEBUG instead of WARNING.
Definition: Logger.h:100
The storage namespace.
Definition: Actiongraph.h:39
LogLevel
Enum with log levels.
Definition: Logger.h:37
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....
Logger * get_stdout_logger()
Returns a Logger that logs to stdout.
Logger * get_logger()
Get the current logger object.
void set_logger(Logger *logger)
Set the current logger object.