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

Log as soon as the request is received #276

Open
ilbonte opened this issue Jul 31, 2022 · 0 comments
Open

Log as soon as the request is received #276

ilbonte opened this issue Jul 31, 2022 · 0 comments

Comments

@ilbonte
Copy link

ilbonte commented Jul 31, 2022

Just finished setting up express-winston along winston and my logs looks something like this:

1/8/2022, 00:00:34 info:        User 34 is retrieving phone numbers for group 15
1/8/2022, 00:00:34 info:        Requesting phone numbers for group 15
1/8/2022, 00:00:34 info:        Phone numbers for group 15 retrieved
1/8/2022, 00:00:35 info:        GET /api/phone-numbers 200 413ms

What I'd like to have is something like this:

Note that the method and the path are on the first line

1/8/2022, 00:00:34 info:        GET /api/phone-numbers
1/8/2022, 00:00:34 info:        User 34 is retrieving phone numbers for group 15
1/8/2022, 00:00:34 info:        Requesting phone numbers for group 15
1/8/2022, 00:00:34 info:        Phone numbers for group 15 retrieved

Even better like this where request and response are logged as soon as they appens

1/8/2022, 00:00:34 info:        GET /api/phone-numbers
1/8/2022, 00:00:34 info:        User 34 is retrieving phone numbers for group 15
1/8/2022, 00:00:34 info:        Requesting phone numbers for group 15
1/8/2022, 00:00:34 info:        Phone numbers for group 15 retrieved
1/8/2022, 00:00:35 info:        GET /api/phone-numbers 200 413ms

Is it possible to achieve this with express-winston?

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

1 participant