24 #ifndef STORAGE_LOGGER_H 25 #define STORAGE_LOGGER_H 35 enum class LogLevel { DEBUG = 0, MILESTONE = 1, WARNING = 2, ERROR = 3 };
52 virtual bool test(LogLevel log_level,
const std::string& component);
57 virtual void write(LogLevel log_level,
const std::string& component,
const std::string& file,
58 int line,
const std::string&
function,
const std::string& content) = 0;
108 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:41
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.
The storage namespace.
Definition: Actiongraph.h:37
Class to make some exceptions log-level DEBUG instead of WARNING.
Definition: Logger.h:97
Logger * get_stdout_logger()
Returns a Logger that logs to stdout.