You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include<Logger.h>intmain() {
Logger mainLogger("MAIN");
Logger::console = Logger::openStaticOutputStream(std::cout);
Logger::outputs[Logger::LVL_ERROR] = Logger::openFileOutput("./errors.log");
// or use: Logger::setAllOutputs to set every level// below this log level, everything will be printed and written to files
Logger::logLevel = Logger::Level::VERBOSE2;
mainLogger.log("This will get printed, but will not be written to errors.log");
mainLogger.error("This is an error, in errors.log and the console");
mainLogger.anonymous("This will be written to the console, but never to outputs");
Logger::console = nullptr;
mainLogger.anonymous("Nothing will appear in the console that is set to null");
}
Integration with CMake FetchContent:
Include(FetchContent)
FetchContent_Declare(
logger
GIT_REPOSITORY https://github.com/cccolda/logger.git
GIT_TAG main
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(logger)
target_link_libraries(my_target PUBLIC colda::logger)