Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(trace): improve trace #249

Closed
wants to merge 64 commits into from
Closed
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
8afbc2f
Exploring new tracing
dadepo Aug 25, 2024
2330ef6
Committed files
dadepo Aug 25, 2024
6558f7a
How polymorphism via a vtable might look
dadepo Aug 26, 2024
5c233e7
Added multiple methods
dadepo Aug 27, 2024
e163930
Run log through channel
dadepo Aug 28, 2024
7176238
Switch to RecycleFBA
dadepo Aug 29, 2024
73c9148
Run logWithFields through channel
dadepo Aug 29, 2024
fdd78f8
Moved all methods
dadepo Aug 29, 2024
c0e98ba
Fix garbled text
dadepo Aug 29, 2024
211ad58
Remove chaining implementation
dadepo Aug 29, 2024
8a1091e
Use allocated memory to also construct key value
dadepo Aug 30, 2024
da350df
Some renaming
dadepo Aug 30, 2024
bde034c
Seitching scope
dadepo Aug 30, 2024
10a883e
Partial fix of leak
dadepo Aug 30, 2024
7085987
Fix leak
dadepo Sep 1, 2024
1825d74
Add level guard
dadepo Sep 1, 2024
e31caf5
Remove todo
dadepo Sep 1, 2024
d5ad7a1
Added static dispatch polymorphism
dadepo Sep 1, 2024
852c407
Rename variable
dadepo Sep 1, 2024
4a7c0f1
Allocate based on size of fmt message
dadepo Sep 1, 2024
74ef498
Pass log message as a reference
dadepo Sep 2, 2024
1dec7e2
Added test logger that tests formats of log message
dadepo Sep 2, 2024
49aa9a4
Move struct used for testing inside testing block
dadepo Sep 3, 2024
cd663e2
Merge branch 'main' into dade/trace-ng
dadepo Sep 3, 2024
7443030
Reset alloc_allocator on print
dadepo Sep 3, 2024
e0b38ab
Pass log message as a value and not reference
dadepo Sep 3, 2024
e111011
Fmt
dadepo Sep 3, 2024
b4f0e83
Snake case for variable
dadepo Sep 3, 2024
41cf812
Take the scope as a string
dadepo Sep 4, 2024
52229ab
Use if expressions
dadepo Sep 4, 2024
3089747
Renaming
dadepo Sep 4, 2024
fda382a
Move custom logic from interface into implementation
dadepo Sep 4, 2024
d164389
Have the union fields as pointers and removed use of ptrCast
dadepo Sep 4, 2024
847553e
Removed use of @ptrCast in test logger
dadepo Sep 5, 2024
826eb0d
Made scoping function public
dadepo Sep 5, 2024
bff2d81
Remove the recycle_fba allocator from the test allocator
dadepo Sep 5, 2024
5c47daa
Merge branch 'main' into dade/trace-ng
dadepo Sep 5, 2024
862dfc3
Removed recyclefba from test logger
dadepo Sep 5, 2024
c4b59af
Switch to use updated API for RecycleFBA
dadepo Sep 5, 2024
ff57936
Do not panic in standard logger but ignore the errors
dadepo Sep 5, 2024
1b52a7f
Drop the spawn method
dadepo Sep 5, 2024
6f2bcd4
Return error on inti instead of panic
dadepo Sep 5, 2024
26f97ba
Add methods
dadepo Sep 5, 2024
dd1e13b
Fix warnfWithFields
dadepo Sep 6, 2024
06d3257
Estimate field size and not hardcode to 512
dadepo Sep 6, 2024
7c233b8
Fmt
dadepo Sep 6, 2024
81d38a6
Removed unused line
dadepo Sep 6, 2024
0be2b8a
Test logger does not need the max_buffer
dadepo Sep 6, 2024
2c6d054
Removed last @ptrCast and some minor clean ups
dadepo Sep 8, 2024
792e8bb
Implementation out of the union
dadepo Sep 8, 2024
33a9877
Removed unintended diff
dadepo Sep 8, 2024
eeb08bd
Hack to ensure child logs show up in std err
dadepo Sep 8, 2024
615f5c2
Ensure the test logger is only used in tests
dadepo Sep 8, 2024
fa0d2bf
Remove panic from unscoped and scope
dadepo Sep 8, 2024
890133f
Do not ignore errors but fallback to std.debug.print
dadepo Sep 9, 2024
990c827
Typo
dadepo Sep 10, 2024
0a52225
Fixed hidden broken compilation
dadepo Sep 10, 2024
460cf27
Have implementation as struct instead of type functions
dadepo Sep 10, 2024
3c23009
Limit the scope of holding the lock on std err
dadepo Sep 10, 2024
822c6c3
Remove the sleep
dadepo Sep 10, 2024
610ec6a
Switched to pattern of concrete instance turning itself to interface
dadepo Sep 11, 2024
45c4535
Moved the write out of the loop
dadepo Sep 11, 2024
7d576d4
Typo
dadepo Sep 11, 2024
5d929f1
Update scope switch test
dadepo Sep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/sig.zig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub const rpc = @import("rpc/lib.zig");
pub const shred_collector = @import("shred_collector/lib.zig");
pub const sync = @import("sync/lib.zig");
pub const trace = @import("trace/lib.zig");
pub const trace_ng = @import("trace_ng/lib.zig");
pub const utils = @import("utils/lib.zig");
pub const version = @import("version/version.zig");
pub const time = @import("time/lib.zig");
Expand Down
22 changes: 22 additions & 0 deletions src/trace_ng/level.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
pub const Level = enum {
/// Error: something has gone wrong. This might be recoverable or might
/// be followed by the program exiting.
err,
/// Warning: it is uncertain if something has gone wrong or not, but the
/// circumstances would be worth investigating.
warn,
/// Info: general messages about the state of the program.
info,
/// Debug: messages only useful for debugging.
debug,

/// Returns a string literal of the given level in full text form.
pub fn asText(self: Level) []const u8 {
return switch (self) {
.err => "error",
.warn => "warning",
.info => "info",
.debug => "debug",
};
}
};
2 changes: 2 additions & 0 deletions src/trace_ng/lib.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub const log = @import("log.zig");
pub const logfmt = @import("logfmt.zig");
Loading
Loading