This is a library I've been working on with versions for C++, java & C# where you make custom formats and Log based on them, for example you could make an ERROR Like this:
// define the master format
master_style = "%C[%N]%c%S%G[%D %T %Z]%c %M %G(%F:%t:%L)";
// tell the logger what colour to use for a given name
logger.add_format("ERROR", master_style, Colour::RED);
so now the [ERROR] part will be red,
the time area will be grey,
and the location grey,
but you could really make any style you wanted.
And once you have a master format you could also add different types of logs:
also the %S we put in there is actualy a colum padder so you logs will be inline:
[INFO] [16/06/2026 10:58:00 AUS Eastern Standard Time] Initializing core subsystem components. (src/main.cpp:1:39)
[SUCCESS][16/06/2026 10:58:00 AUS Eastern Standard Time] Database connection established smoothly. (src/main.cpp:1:40)
[WARN] [16/06/2026 10:58:00 AUS Eastern Standard Time] High memory usage detected on node cluster. (src/main.cpp:1:41)
[ERROR] [16/06/2026 10:58:00 AUS Eastern Standard Time] Failed to write to write-ahead log! (src/main.cpp:1:42)
0 comments
—
Show HN: C++, Java and C# light-weight-logger · HackerTrans
but you would write it like this:
so now the [ERROR] part will be red, the time area will be grey, and the location grey, but you could really make any style you wanted. And once you have a master format you could also add different types of logs:
also the %S we put in there is actualy a colum padder so you logs will be inline: