doc: update README; update comments regarding open tasks and further features
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 54s
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 54s
This commit is contained in:
10
src/root.zig
10
src/root.zig
@@ -5,22 +5,20 @@ fn logFn(
|
||||
comptime format: []const u8,
|
||||
args: anytype,
|
||||
) void {
|
||||
// TODO provide build time configuration to allow tweaking corresponding output
|
||||
// - change output file for writing messages to (default `stderr`)
|
||||
// - write into own file for each level?
|
||||
|
||||
const prefix = if (scope == .default) ": " else "(\x1b[2m" ++ @tagName(scope) ++ "\x1b[0m): ";
|
||||
// TODO this should only happen for messages that are written to *stderr* in files the escape codes are only annoying
|
||||
const level_txt = switch (comptime message_level) {
|
||||
.err => "[\x1b[38;5;9merror\x1b[0m]",
|
||||
.warn => "[\x1b[38;5;11mwarning\x1b[0m]",
|
||||
.info => "[\x1b[38;5;10minfo\x1b[0m]",
|
||||
.debug => "[\x1b[38;5;12mdebug\x1b[0m]",
|
||||
};
|
||||
// TODO let user configure the format he wants to use for logging and use a pretty good default one?
|
||||
const complete_format = level_txt ++ prefix ++ format ++ "\n";
|
||||
var buf: [128]u8 = undefined;
|
||||
if (comptime build_options.file.len > 0) {
|
||||
// TODO handle errors accordingly (i.e. panic?)
|
||||
// NOTE with zig 0.13.0 there is currently no way to open files to append (except to use libc or talk directly to posix, which this lib should not have to do)
|
||||
// TODO use common logging format, such that in integrates well with other logging frameworks
|
||||
// (i.e. golang's logger, log4j, etc.)
|
||||
const fd = std.posix.open(build_options.file, .{
|
||||
.CREAT = true,
|
||||
.APPEND = true,
|
||||
|
||||
Reference in New Issue
Block a user