add(timestamp): timestamp build configuration option to add timestamps before log messages
Run Tests / test (push) Successful in 9m33s
Run Tests / lint (push) Successful in 9m43s

This commit is contained in:
2024-08-28 22:25:06 +02:00
parent 510b3ddfcf
commit eb7e78697c
3 changed files with 32 additions and 20 deletions
+11 -5
View File
@@ -63,15 +63,15 @@ pub fn main() void {
This will result in the following output:
```
debug(main): Debug message 42
info(main): Info message { 1, 2, 3, 4 }
info(main): Info message "This is a test"
warning(main): Warning message main.Options = enum {
[2024-08-28 22:22] debug(main): Debug message 42
[2024-08-28 22:22] info(main): Info message { 1, 2, 3, 4 }
[2024-08-28 22:22] info(main): Info message "This is a test"
[2024-08-28 22:22] warning(main): Warning message main.Options = enum {
a,
b,
c,
} = a
error(main): Error message main.Struct = struct {
[2024-08-28 22:22] error(main): Error message main.Struct = struct {
.a = 42,
.b = true,
.c = []u16: { 1, 2, 3, 4, 5 },
@@ -83,3 +83,9 @@ error(main): Error message main.Struct = struct {
} = b,
}
```
## Customization
For more details about the output customization see the configuration options of the `zlog` module. Following options are available:
- _timestamp_ (default: `true`): Prepend the current timestamp before each log message.