Skip to content

Log as soon as the request is received  #276

@ilbonte

Description

@ilbonte

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions