middleware-logger
HTTP request logger middleware for Marble.js
Simple middleware for request logging inside your console. It displays the outgoing request events using the following format:
Installation
Requires @marblejs/core
to be installed.
Importing
Type declaration
Parameters
parameter | definition |
options | <optional> |
LoggerOptions
parameter | definition |
silent | <optional> |
stream | <optional> |
filter | <optional> |
Usage
Default behaviour. Log every response to process.stdout:
2. Customized logging behaviour:
silent - When
true
the logging is turned off (usually useful during testing),stream - Output stream for writing log messages, defaults to process.stdout. In the example above every response will be written to file pointed by provided
PATH
variable,filter - Filter outgoing responses or incoming requests based on given predicate. For example we can log only HTTP status codes above 400.
Last updated