Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.18..27)
|
||||
cmake_minimum_required(VERSION 3.18..3.27)
|
||||
PROJECT(jlog
|
||||
VERSION 1.0
|
||||
LANGUAGES CXX
|
||||
|
@@ -187,4 +187,38 @@ namespace jlog {
|
||||
extern GenericLogger Fatal;
|
||||
extern GenericLogger Verbose;
|
||||
extern GenericLogger Debug;
|
||||
|
||||
class LibraryLogger {
|
||||
public:
|
||||
LibraryLogger(const std::string libname) :
|
||||
Info {libname + "::" + "info", GlobalLogFile, Colors::Green, Colors::Gray, Colors::Gray, Colors::Green, Colors::White},
|
||||
Warning {libname + "::" + "warning", GlobalLogFile, Colors::Yellow, Colors::Gray, Colors::Gray, Colors::Yellow, Colors::White},
|
||||
Error {libname + "::" + "error", GlobalLogFile, Colors::Red, Colors::Gray, Colors::Gray, Colors::Red, Colors::White},
|
||||
Fatal {libname + "::" + "fatal", GlobalLogFile, Colors::Reds::Crimson, Colors::Gray, Colors::Gray, Colors::Reds::Crimson, Colors::White},
|
||||
Verbose {libname + "::" + "verbose", GlobalLogFile, Colors::Blue, Colors::Gray, Colors::Gray, Colors::Blue, Colors::White},
|
||||
Debug {libname + "::" + "debug", GlobalLogFile, Colors::Purples::Purple, Colors::Gray, Colors::Gray, Colors::Purples::Purple, Colors::White}
|
||||
{}
|
||||
public:
|
||||
GenericLogger Info;// {"info", GlobalLogFile, Colors::Green, Colors::Gray, Colors::Gray, Colors::Green, Colors::White};
|
||||
GenericLogger Warning;// {"warning", GlobalLogFile, Colors::Yellow, Colors::Gray, Colors::Gray, Colors::Yellow, Colors::White};
|
||||
GenericLogger Error;// {"error", GlobalLogFile, Colors::Red, Colors::Gray, Colors::Gray, Colors::Red, Colors::White};
|
||||
GenericLogger Fatal;// {"fatal", GlobalLogFile, Colors::Reds::Crimson, Colors::Gray, Colors::Gray, Colors::Reds::Crimson, Colors::White};
|
||||
GenericLogger Verbose;// {"verbose", GlobalLogFile, Colors::Blue, Colors::Gray, Colors::Gray, Colors::Blue, Colors::White};
|
||||
GenericLogger Debug;// {"debug", GlobalLogFile, Colors::Purples::Purple, Colors::Gray, Colors::Gray, Colors::Purples::Purple, Colors::White};
|
||||
public:
|
||||
void EnableAll(bool b) {
|
||||
Info.EnableConsole(b);
|
||||
Info.EnableFile(b);
|
||||
Warning.EnableConsole(b);
|
||||
Warning.EnableFile(b);
|
||||
Error.EnableConsole(b);
|
||||
Error.EnableFile(b);
|
||||
Fatal.EnableConsole(b);
|
||||
Fatal.EnableFile(b);
|
||||
Verbose.EnableConsole(b);
|
||||
Verbose.EnableFile(b);
|
||||
Debug.EnableConsole(b);
|
||||
Debug.EnableFile(b);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -1,8 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
#include <mcolor.h>
|
||||
#include "Colors.hpp"
|
||||
#include <Colors.hpp>
|
||||
|
||||
namespace jlog {
|
||||
using namespace mcolor;
|
||||
|
17
main.cpp
17
main.cpp
@@ -6,8 +6,6 @@
|
||||
// This work is dedicated to the public domain.
|
||||
#include "jlog/Logger.hpp"
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
jlog::GenericLogger Demo("demo", jlog::GlobalLogFile);
|
||||
@@ -18,6 +16,21 @@ int main()
|
||||
jlog::Fatal("dsadsd");
|
||||
jlog::Verbose("dsadsd");
|
||||
jlog::Debug("dsadsd");
|
||||
jlog::LibraryLogger libtest("JLog");
|
||||
libtest.Info("A");
|
||||
libtest.Warning("B");
|
||||
libtest.Debug("C");
|
||||
libtest.Error("D");
|
||||
libtest.Fatal("E");
|
||||
libtest.Verbose("G");
|
||||
libtest.EnableAll(false);
|
||||
libtest.Info("A2");
|
||||
libtest.Warning("B2");
|
||||
libtest.Debug("C2");
|
||||
libtest.Error("D2");
|
||||
libtest.Fatal("E2");
|
||||
libtest.Verbose("G2");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#include "jlog/Token.hpp"
|
||||
#include <jlog/Token.hpp>
|
||||
#include <ostream>
|
||||
|
||||
namespace jlog {
|
||||
std::string token::Stringer(bool includeColor) {
|
||||
|
Reference in New Issue
Block a user