Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve(trace): incorporate the new logger (#277)
* Exploring new tracing * Committed files * How polymorphism via a vtable might look * Added multiple methods * Run log through channel * Switch to RecycleFBA * Run logWithFields through channel * Moved all methods * Fix garbled text * Remove chaining implementation * Use allocated memory to also construct key value * Some renaming * Seitching scope * Partial fix of leak * Fix leak * Add level guard * Remove todo * Added static dispatch polymorphism * Rename variable * Allocate based on size of fmt message * Pass log message as a reference * Added test logger that tests formats of log message * Move struct used for testing inside testing block * Reset alloc_allocator on print * Pass log message as a value and not reference * Fmt * Snake case for variable * Take the scope as a string * Use if expressions * Renaming * Move custom logic from interface into implementation * Have the union fields as pointers and removed use of ptrCast * Removed use of @ptrCast in test logger * Made scoping function public * Remove the recycle_fba allocator from the test allocator * Removed recyclefba from test logger * Switch to use updated API for RecycleFBA * Do not panic in standard logger but ignore the errors * Drop the spawn method * Return error on inti instead of panic * Add methods * Fix warnfWithFields * Estimate field size and not hardcode to 512 * Fmt * Removed unused line * Test logger does not need the max_buffer * Removed last @ptrCast and some minor clean ups * Implementation out of the union * Removed unintended diff * Hack to ensure child logs show up in std err * Ensure the test logger is only used in tests * Remove panic from unscoped and scope * Do not ignore errors but fallback to std.debug.print * Typo * Fixed hidden broken compilation * Have implementation as struct instead of type functions * Limit the scope of holding the lock on std err * Remove the sleep * Switched to pattern of concrete instance turning itself to interface * Moved the write out of the loop * Typo * Update scope switch test * First batch of changes * Another batch of integrating the new logger * Remove instances of the old trace module * fmt * Renamed trace_ng to trace * Check in trace_ng renamed to trace * Remove listing error sets * Pass the Logger by value * clean up in db.zig * clean up in fuzz.zig * clean up in cmd.zig * Update test assertion * clean up in hard_forks.zig * clean up in shred.zig * clean up in fuzz_service.zig * clean up in fuzz_table.zig * clean up in fuzz.zig * clean up in service.zig * clean up in database.zig * clean up in insert_shred.zig * clean up in socket_utils.zig * clean up in repair_service.zig * clean up in shred_tracker.zig * clean up in estimate.zig * errdefer instead of defer * Switch API to support chaining for fields * Fix up * No need to have nooLoop var * Update comment * Remove the need for fmt * Fixes after merge * Remove unused * Tem comment out code * Compile fix * Renaming * Use Config only ChannelPrintLogger * Pass by value for Entry instead of allocating * Rename variable * deinit the entry after logging * Fix bus error * Switching to init the noop logger by variant * Remove unused import * Fix .noop * Fix test * Set max_buffer to 1GB * Pull out import * Do not redefine std.ArrayList(u8) as Fields * Rename exit_sig to exit * Revert commented out tests * Have fields show in logs * Elide union name when setting the noop variant * Move Self alias to after fields * Fixes after merge conflict * Replace places where empty format args are used in logs * Added trace * Create the writer in same scope as the lock * Newline between method definition * Print the fallthrough type using any * No need to capture logger as a pointer in deinit * Return DirectPrintLogger by value * use same branch for test logger and noop * More removal of empty fmt args after merge * Remove unused variables * Fixes after merge conflict * fix(trace): require comptime message for log to avoid lifetime issues this makes the code less flexible but the only alternative that is memory safe would be to dupe everything. dupe would be a waste since currently the strings are always comptime, so there's actually no need to dupe them. it's better to just require comptime for now and deal with allowing dynamic strings later if we need it. * perf(trace): reduce allocations when formatting fields * fix(trace): warn bug, and don't print in tests * refactor(trace): consistent names for direct and channel print loggers * fix(trace): use after free when log message is freed before being sent down the channel also makes log_msg not optional in direct print entry --------- Co-authored-by: Drew Nutter <[email protected]>
- Loading branch information