Skip to content

c++ logger class , supports multiple threads , multiple output , outputing user types

Notifications You must be signed in to change notification settings

thinkstore/z-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

z-logger

c++ logger , supports multiple threads , multiple output , outputing user types , single file header only c++ logger class

#include "logger.h"
class Point{
    int x, y;

public:
    Point():x(1),y(1){
        
    }

    friend ostream& operator<<(ostream& os , const Point& p ){
        os << "x = " << p.x << " , " << " y = " << p.y ;
        return os;
    }
};

int main(int argc , char* argv[]){
	
	Point p;

	Z::Logger::Init();

	Z::Logger::AddFile("debug_log.txt" , Severity::DEBUG);
	Z::Logger::AddFile("info_log.txt" , Severity::INFO );
	Z::Logger::AddFile("warn_log.txt" , Severity::WARN );
	Z::Logger::AddFile("error_log.txt" , Severity::ERROR );
	Z::Logger::AddConsole(Severity::DEBUG);

	Z::ERROR() << "error " << "message" ; 
	Z::WARN()  << "warn " << " message" ;
	Z::INFO()  << "info " << " message ";
	Z::DEBUG() << "debug " << "message " << "with custom object is " << p ;

}

About

c++ logger class , supports multiple threads , multiple output , outputing user types

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published