diff --git a/apps/freelan/src/main.cpp b/apps/freelan/src/main.cpp index ee9c992c..fdada81b 100644 --- a/apps/freelan/src/main.cpp +++ b/apps/freelan/src/main.cpp @@ -430,6 +430,7 @@ bool parse_options(fscp::logger& logger, int argc, char** argv, cli_configuratio if (configuration.debug) { logger.set_level(fscp::log_level::trace); + logger(fscp::log_level::trace) << "Debug output enabled."; } setup_configuration(logger, configuration.fl_configuration, vm); @@ -474,6 +475,8 @@ void run(fscp::logger& logger, const cli_configuration& configuration, int& exit fl::core core(io_service, configuration.fl_configuration); + logger(fscp::log_level::information) << "Setting core logging level to: " << logger.level() << "."; + core.set_log_level(logger.level()); core.set_log_callback(log_func); diff --git a/libs/fscp/include/fscp/logger.hpp b/libs/fscp/include/fscp/logger.hpp index 11a6ff67..335e462f 100644 --- a/libs/fscp/include/fscp/logger.hpp +++ b/libs/fscp/include/fscp/logger.hpp @@ -71,6 +71,35 @@ namespace fscp fatal /**< \brief The fatal log level. */ }; + /** + * \brief Output a log level as its string representation. + * \param os The output stream. + * \param lvl The log level. + * \return os. + */ + inline std::ostream& operator<<(std::ostream& os, log_level lvl) + { + switch (lvl) + { + case log_level::trace: + return os << "trace"; + case log_level::debug: + return os << "debug"; + case log_level::information: + return os << "information"; + case log_level::important: + return os << "important"; + case log_level::warning: + return os << "warning"; + case log_level::error: + return os << "error"; + case log_level::fatal: + return os << "fatal"; + default: + return os << ""; + } + } + /** * \brief A null logger stream. */