-
Notifications
You must be signed in to change notification settings - Fork 0
Home
My goal in this project is to make a industrial standard Logging system for C++ and also make 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 😊❤️.
#include "SyncLogging.h"
int main(){
SyncLogging logger;
}
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 "SyncLogging.h"
int main(){
SyncLogging logger;
logger.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 setSaveLogFileStatus(true);
and to stopping it set the function to false
.
Note
The default name of log file is log.log
int main() {
//make an instance
SyncLogging logger;
logger.setSaveLogFileStatus(true); //start logging into the file
logger.Log(LogLevel::ERROR, "This is an error log"); //default filename is Log.log
logger.setSaveLogFileStatus(false); //Stop logging into the file
}
you can also set your file name by calling setFileName("name")
and pass a string as an argument.
int main() {
//make an instance
SyncLogging logger;
logger.setFileName("Logging"); // add your custom name for log file
logger.setSaveLogFileStatus(true); //start logging into the file
logger.Log(LogLevel::ERROR, "This is an error log");
logger.setSaveLogFileStatus(false); //Stop logging into the file
}