-
Notifications
You must be signed in to change notification settings - Fork 0
Home
My goal in this project is to make industrial standard Logging system for C++ and also make a fancy features for developers to let them debug their code easier. This project won't be perfect without your help so feel free to contribute in this project 😊❤️.
because the Logger is a single tone you have to make an instance with Logger::initiLogger()
#include "Logger.h"
int main(){
Logger* log = Logger::initLogger();
}if you want only log data and errors on the console not in a file you can easily do it by Log(LogLevel, "message")
Note
this library has levels {LogLevel::INFO, LogLevel::DEBUG, LogLevel::Warning, LogLevel::ERROR, LogLevel::CRITICAL, LogLevel::FATAL}
#include "Logger.h"
int main(){
Logger* log = Logger::initLogger();
log->Log(LogLevel::ERROR, "This is an error log")
}the way you can save all of these logs in a file is easy you just have to set setLoggingStatus(true); and info you set it false, file logging will be disabled.
Note
The default name of log file is log.log
int main() {
Logger* log = Logger::initLogger();
log->setLoggingStatus(true);
log->Log(LogLevel::ERROR, "This is an error log");
log->setLoggingStatus(false);
}you can also set your file name by calling setLoggingFilename("name") and pass a string as an argument.
int main() {
Logger* log = Logger::initLogger();
log->setLoggingStatus(true);
log->setLoggingFilename("Logging");
log->Log(LogLevel::ERROR, "This is an error log");
log->setLoggingStatus(false);
}