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

[Question] Is it possible to accumulate logs to an array #362

Open
WhoAteDaCake opened this issue Sep 22, 2021 · 2 comments
Open

[Question] Is it possible to accumulate logs to an array #362

WhoAteDaCake opened this issue Sep 22, 2021 · 2 comments

Comments

@WhoAteDaCake
Copy link

WhoAteDaCake commented Sep 22, 2021

I'm trying to track logs per each specific run of a function with a uuid parameter. Is there a way to make sure all logs get accumulated within array, which I could empty for each run? Ideally with access to all parameters that were passed while logging: Str, Int (custom values while logging). I tried Hooks but they only have the Event struct, which doesn't contain all the data

@rs
Copy link
Owner

rs commented Sep 22, 2021

You can do that in a writer.

@mitar
Copy link
Contributor

mitar commented Aug 20, 2023

I have made #583 with a more concrete proposal to support such "batching" (or what you call accumulation). I also think it would be nice to be able to batch log lines together while exposing same "logger" interface to the code.

With a writer it is a problem because you are operating already on JSON so you you have to parse/modify/marshal. Also it is a problem that you do not necessary have all the information anymore (for example, when exactly has the logging for the request finished, you have to guess that from log lines or add some sentinel log line or something).

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

No branches or pull requests

3 participants