mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	feat: add request logger env variable (#4614)
Adds a new env variable for request logger. --------- Co-authored-by: Gastón Fournier <gaston@getunleash.io>
This commit is contained in:
		
							parent
							
								
									41858a4952
								
							
						
					
					
						commit
						1ae700a027
					
				@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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`.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user