Skip to content

I made this logger to make reading debug info easier, and also provided logging system into a file so you can have access to those data whenever you want

License

Notifications You must be signed in to change notification settings

SergeantMahdi/CPP_Logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logger Library

Header

This is a simple logger that I made to simplify and also store the debugging information that might be critical in the future. You can use this library whether for only console logging or save those logging into custom file

Note

NEW UPDATE: The structure has been changed, read the doc for the usage of loggingsystem

Note

NOTE: Thread Safety is added

Guide

make an instance:

#include "SyncLogging.h"
int main(){

SyncLogging logger;

}

To log into console only:

#include "SyncLogging.h"

int main(){

SyncLogging logger;

logger.Log(LogLevel::ERROR, "This is an error log") 
}

To start and stop logging into a file:

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
}

To log in a file with a custom file name:

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
}

All the LogLevels :

enum class LogLevel {
	DEBUG,
	INFO,
	WARNING,
	ERROR,
	CRITICAL,
	FATAL
};

Screenshots

Loggin into the console

loggingFile

Loggin into a file

loggingFile

About

I made this logger to make reading debug info easier, and also provided logging system into a file so you can have access to those data whenever you want

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages