loopbackio / loopbackio/loopback-next

Logging Extension Improvements

Offen
#5,464 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

feature
Vorherrschende Sprache
TypeScript
Sterne
5.1k
Forks
1.1k
Ø Merge
2 T. 21 Std.
Gemergte PRs (30 T.)
27

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, den Pfad zur Anwendungsinitialisierung, die Migrationsskripte, die main-Funktion und die Middleware für das HTTP-Access-Logging zu lokalisieren. Kläre die fehlenden Akzeptanzkriterien mit dem Team und definiere anschließend den Abschluss so, dass während des Bootens und der Migrationen ein globaler strukturierter Logger verfügbar ist und anpassbare JSON-HTTP-Access-Logs für externe Services vorhanden sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
google-cloud, node.js, typescript
Bereich
api, backend, observability
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
20/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.