Compare commits
7 Commits
Prerelease
...
Prerelease
Author | SHA1 | Date | |
---|---|---|---|
cf4e19e340 | |||
12d3714eda | |||
f3cec87518 | |||
7c9a3bddc8 | |||
16a2b8ead0 | |||
82fb6c64ca | |||
b3dbd1b556 |
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.18..27)
|
cmake_minimum_required(VERSION 3.18..3.27)
|
||||||
PROJECT(jlog
|
PROJECT(jlog
|
||||||
VERSION 1.0
|
VERSION 1.0
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
@@ -23,12 +23,12 @@ include_directories("include")
|
|||||||
|
|
||||||
CPMAddPackage(
|
CPMAddPackage(
|
||||||
NAME Event
|
NAME Event
|
||||||
URL https://git.redacted.cc/josh/Event/archive/Release-10.zip
|
URL https://git.redacted.cc/josh/Event/archive/Release-12.zip
|
||||||
)
|
)
|
||||||
|
|
||||||
CPMAddPackage(
|
CPMAddPackage(
|
||||||
NAME mcolor
|
NAME mcolor
|
||||||
URL https://git.redacted.cc/maxine/mcolor/archive/Prerelease-4.zip
|
URL https://git.redacted.cc/maxine/mcolor/archive/Prerelease-5.zip
|
||||||
)
|
)
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
|
@@ -187,4 +187,38 @@ namespace jlog {
|
|||||||
extern GenericLogger Fatal;
|
extern GenericLogger Fatal;
|
||||||
extern GenericLogger Verbose;
|
extern GenericLogger Verbose;
|
||||||
extern GenericLogger Debug;
|
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
|
#pragma once
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <string>
|
||||||
|
#include <ostream>
|
||||||
#include <mcolor.h>
|
#include <mcolor.h>
|
||||||
#include "Colors.hpp"
|
#include <Colors.hpp>
|
||||||
|
|
||||||
namespace jlog {
|
namespace jlog {
|
||||||
using namespace mcolor;
|
using namespace mcolor;
|
||||||
|
17
main.cpp
17
main.cpp
@@ -6,8 +6,6 @@
|
|||||||
// This work is dedicated to the public domain.
|
// This work is dedicated to the public domain.
|
||||||
#include "jlog/Logger.hpp"
|
#include "jlog/Logger.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
jlog::GenericLogger Demo("demo", jlog::GlobalLogFile);
|
jlog::GenericLogger Demo("demo", jlog::GlobalLogFile);
|
||||||
@@ -18,6 +16,21 @@ int main()
|
|||||||
jlog::Fatal("dsadsd");
|
jlog::Fatal("dsadsd");
|
||||||
jlog::Verbose("dsadsd");
|
jlog::Verbose("dsadsd");
|
||||||
jlog::Debug("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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#include "jlog/Token.hpp"
|
#include <jlog/Token.hpp>
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
namespace jlog {
|
namespace jlog {
|
||||||
std::string token::Stringer(bool includeColor) {
|
std::string token::Stringer(bool includeColor) {
|
||||||
|
Reference in New Issue
Block a user