SudoSOS Back-end API / internal / helpers
Internal: Helpers ​
This is the module page of logging.
Classes ​
| Class | Description |
|---|---|
| POSTokenVerifier | Utility class for verifying POS tokens in lesser authentication scenarios. This class handles the verification logic for ensuring that lesser tokens (PIN/NFC authentication) are properly associated with the correct POS. |
Interfaces ​
| Interface | Description |
|---|---|
| RequestContext | Diagnostic information about the request that is currently being handled. |
| StructuredLogEvent | The shape of a single line of JSON log output. |
Functions ​
| Function | Description |
|---|---|
| applyConfiguredLogLevel | - |
| flattenLogData | Split the arguments of a log call into its message and its fields. The first string that was logged becomes the message, plain objects are merged into the fields, and everything else ends up under args. Both log('msg', { field }) and log({ field }, 'msg') are therefore understood. |
| getAppLogger | - |
| getConfiguredLogLevel | - |
| getRequestContext | - |
| initRedisConnection | Try to connect to Redis. If it is unreachable in non-production environments, resolves to undefined so callers can fall back to direct SMTP sending. In production a missing Redis connection is a hard failure. |
| runWithRequestContext | Run the given function with the given request context bound to it. The context remains available in everything the function awaits or schedules. |
| setRequestActor | Record which user the current request is authenticated as. Does nothing when called outside of a request. |
| toPrettyLogLine | Render a log4js event as a single human-readable line, keeping the request id so that the pretty format stays correlatable as well. |
| toStructuredLogEvent | Flatten a log4js event into a single record, annotated with the context of the request that produced it. |