Skip to content

This is a simple logging library that is made to colorize errors and info based on their levels. It'll allow you to store the information with their levels and time occurance inside a file with a custome name.

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

51 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logger Library

Header

This is a simple logging library that is made to colorize errors and info based on their levels. It'll allow you to store the information with their levels and time occurance inside a file with a custome name.

Note

NEW UPDATE: The setSaveLogFileStatus function name changed to enableFileLogging

Note

NOTE: Thread Safety is added

Guide

Making An Instance:

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

SyncLogging logger;

}

Printing Information Only In The Console:

#include "SyncLogging.h"

int main(){

SyncLogging logger;

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

Start / Stop Storing Information In A File:

int main() {

//make an instance
	SyncLogging logger;

	logger.enableFileLogging(true); //start logging into the file

	logger.Log(LogLevel::ERROR, "This is an error log"); //default filename is Log.log

	logger.enableFileLogging(false); //Stop logging into the file
}

Set A Custom File Name:

int main() {

//make an instance
	SyncLogging logger;

	logger.setFileName("Logging"); // add your custom name for log file

	logger.enableFileLogging(true); //start logging into the file

	logger.Log(LogLevel::ERROR, "This is an error log"); 
	
	logger.enableFileLogging(false); //Stop logging into the file
}

Information Levels Based On Their Importance :

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

Screenshots

Colorized Information

loggingFile

File Structure Of Stored Data

loggingFile

About

This is a simple logging library that is made to colorize errors and info based on their levels. It'll allow you to store the information with their levels and time occurance inside a file with a custome name.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages