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

slog: structured logging #1

Closed
wants to merge 11 commits into from
Closed

slog: structured logging #1

wants to merge 11 commits into from

Conversation

ellemouton
Copy link
Member

@ellemouton ellemouton commented Sep 17, 2024

See the OG PR here: btcsuite#17

all the initial commits are the same. Only addition is the last few commits that just removes the old logger impl & runs unit tests in GH. Also basic Readme updates.

So that it does not clash with the standard lib's slog package.
Reuse some of the slog.Level types and add a few of our own.

Also, move level logic to its own file for readability.
And let subLog implement the methods by calling its existing methods.
Note that subLog will not produce structured logs as of this commit. In
future, it can be updated to use an slog.Logger and this package can
implement a default slog.Handler.
Update the buffer pool to use a concrete type and steel some other
updates from the buffer pool used by std lib. Also adds a few useful
helpers that we will use later on and also factors out the timestamp
writing part from formatHeader since we will use that again later.
Since we will use it later no with a different skip depth.
@ellemouton ellemouton force-pushed the slog branch 4 times, most recently from 30a57a4 to b060cde Compare September 23, 2024 03:49
Which is a valid Handler that can be used with the NewSloggger call.
@ellemouton
Copy link
Member Author

ellemouton commented Sep 23, 2024

cc @yyforyongyu - This is the same as the PR in btclog but just with the module name updated & the travis file removed. I'll open a follow up that adds basic CI for unit tests and that removes the old logger implementation which will address Oli's comment in the other PR.

The reason im splitting this into this and a follow up is:

  1. We already have double ACK of these commits so let's not add more review burden
  2. The LND PR that updates the logger dep can be more piecemeal and the first commit can just update the dep rather than also needing to immediately start using the new logger impl (ie, leave the old impl for a bit).

Copy link
Member

@yyforyongyu yyforyongyu left a comment

Choose a reason for hiding this comment

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

Gogogo🎉

@ellemouton
Copy link
Member Author

closing in favour of a v2 module in the upstream repo

@ellemouton ellemouton closed this Oct 15, 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.

2 participants