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

improve(trace): incorporate the new logger #277

Merged
merged 138 commits into from
Oct 8, 2024
Merged

Conversation

dadepo
Copy link
Contributor

@dadepo dadepo commented Sep 26, 2024

TODO:

  • Update remaining places old logger is still being referenced
  • Delete old logger, rename trace_ng to trace
  • Fix the "expected type 'error{NoSpaceLeft}', found 'error{OutOfMemory}" showing up in some places.
  • Revisit the default_logger in old logger and replicate if necessary
    - default_logger is a standard error logger that is set to undefined see https://github.com/Syndica/sig/blob/main/src/trace/log.zig#L15-L16
    - then in places that needs to use the default_logger the actual logger that is not undefined is set. See
    logger.default_logger.* = logger.Logger.init(allocator, .debug);

    - This means if per chance the actual logger is not set, the undefined value would be used.
    - This means this is technically not a default logger, if a value still needs to be set at point of usage
    - Given that it is not a default logger and it creates scenarios for wrong usage, I'll advice this pattern is not replicated in new logger.
  • Ensure noop and TestingLogger are used in the right places

src/trace/logfmt.zig Outdated Show resolved Hide resolved
src/trace/log.zig Outdated Show resolved Hide resolved
0xNineteen
0xNineteen previously approved these changes Oct 7, 2024
Copy link
Contributor

@0xNineteen 0xNineteen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@0xNineteen 0xNineteen requested review from dnut and ultd October 8, 2024 17:45
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.
…t down the channel

also makes log_msg not optional in direct print entry
@dnut dnut dismissed stale reviews from ultd and themself October 8, 2024 19:38

addressed

@dnut dnut merged commit f970d8b into main Oct 8, 2024
6 checks passed
@InKryption InKryption deleted the dade/trace-ng-incorporated branch October 8, 2024 19:47
@dnut dnut mentioned this pull request Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants