Skip to content

Commit

Permalink
feat: add request logger env variable (#4614)
Browse files Browse the repository at this point in the history
Adds a new env variable for request logger.

---------

Co-authored-by: Gastón Fournier <[email protected]>
  • Loading branch information
nunogois and gastonfournier authored Sep 5, 2023
1 parent 41858a4 commit 1ae700a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/create-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@ const defaultServerOption: IServerOption = {
parseEnvVarNumber(process.env.SERVER_KEEPALIVE_TIMEOUT, 15),
),
headersTimeout: secondsToMilliseconds(61),
enableRequestLogger: false,
enableRequestLogger: parseEnvVarBoolean(
process.env.REQUEST_LOGGER_ENABLE,
false,
),
gracefulShutdownEnable: parseEnvVarBoolean(
process.env.GRACEFUL_SHUTDOWN_ENABLE,
true,
Expand Down
1 change: 1 addition & 0 deletions website/docs/reference/deploy/configuring-unleash.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ unleash.start(unleashOptions);
- ~~eventHook~~ (`function(event, data)`) - (_deprecated in Unleash 4.3_ in favor of the [Webhook addon](../addons/webhook.md). **Removed in Unleash 5**) If provided, this function will be invoked whenever a feature is mutated. The possible values for `event` are `'feature-created'`, `'feature-archived'` and `'feature-revived'`. The `data` argument contains information about the mutation. Its fields are `type` (string) - the event type (same as `event`); `createdBy` (string) - the user who performed the mutation; `data` - the contents of the change. The contents in `data` differs based on the event type; For `'feature-archived'` and `'feature-revived'`, the only field will be `name` - the name of the feature. For `'feature-created'` the data follows a schema defined in the code [here](https://github.com/Unleash/unleash/blob/7b7f0b84e8cddd5880dcf29c231672113224b9a7/src/lib/schema/feature-schema.ts#L77). See an [api here](/reference/api/legacy/unleash/admin/events).
- **getLogger** (function) - Used to register a [custom log provider](#how-do-i-configure-the-log-output).
- **logLevel** (`debug` | `info` | `warn` | `error` | `fatal`) - The lowest level to log at, also configurable using environment variable `LOG_LEVEL`.
- **enableRequestLogger** (boolean) - use this to enable logging for requested urls and response codes (default: false).
- **preHook** (function) - this is a hook if you need to provide any middlewares to express before `unleash` adds any. Express app instance is injected as first argument.
- **preRouterHook** (function) - use this to register custom express middlewares before the `unleash` specific routers are added.
- **secureHeaders** (boolean) - use this to enable security headers (HSTS, CSP, etc) when serving Unleash from HTTPS. Can also be configured through the environment variable `SECURE_HEADERS`.
Expand Down

0 comments on commit 1ae700a

Please sign in to comment.