loopbackio / loopbackio/loopback-next

Logging Extension Improvements

Open
#5,464 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
TypeScript
Stars
5.1k
Forks
1.1k
Avg merge
2d 21h
Merged PRs (30d)
27

Description

## Suggestion

- should include a global logger for use outside of the application so that we can make sure to catch and log exceptions for problems with the application boot-up. `console.log` won't cut it here as logs still need to be `json` structured and sent to an external logging service.

- Http Access Logs should be json structured rather than putting the log in string format.

## Use Cases

I'm deploying my application to Google App Engine and structure logs for both normal logs as well as error logs is an absolute must to correctly parse any problems.

## Examples

Logging should be tightly integrated with the application. A global logger should be setup and passed into the application as part of the application initialisation (I suggest simply choosing winston by convention). The global logger can then be accessed by the migration scripts, and can also be used inside the `main` function for circumstances where the application doesn't boot.

The HTTP Access Logger should be a middleware that takes a callback with some for such as:
```
LogCallbackFn(logger: WinstonLogger, req: Request, res: Response)
```
This way the logger call can be customised.

## Acceptance criteria

TBD - will be filled by the team.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the application initialization path, migration scripts, main function, and HTTP access logging middleware. Clarify the missing acceptance criteria with the team, then define completion as a global structured logger available during boot and migrations plus customizable JSON HTTP access logs suitable for external services.

Written by the indexing model from the issue text.

Assessment

Tech stack
google-cloud, node.js, typescript
Domain
api, backend, observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.