Skip to content

is it possible to avoid await while logging to improve api method performance. #1

Open
@GorvGoyl

Description

@GorvGoyl

In the provided example, await is used to write logs in nextjs api routes and it blocks the execution of rest of code. Situation gets worse if there are multiple logs inside a function. Overall reducing the performance of api. Is there a way to asynchronously write logs so that the method stays performant.

await logger.info(
    'Handling a request to /api/hello',
    { user } // you can log structured data
  );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions