feat: add LOG_LEVEL env. var.
This commit is contained in:
@@ -9,6 +9,7 @@ type AppConfig = {
|
|||||||
webAppUrl: string;
|
webAppUrl: string;
|
||||||
webhookUrl: string;
|
webhookUrl: string;
|
||||||
appEnv: string;
|
appEnv: string;
|
||||||
|
logLevel: string;
|
||||||
isDev: boolean;
|
isDev: boolean;
|
||||||
isProd: boolean;
|
isProd: boolean;
|
||||||
postgresDatabase: string;
|
postgresDatabase: string;
|
||||||
@@ -80,6 +81,7 @@ const appConfig: AppConfig = {
|
|||||||
protocol,
|
protocol,
|
||||||
port,
|
port,
|
||||||
appEnv: appEnv,
|
appEnv: appEnv,
|
||||||
|
logLevel: process.env.LOG_LEVEL || 'info',
|
||||||
isDev: appEnv === 'development',
|
isDev: appEnv === 'development',
|
||||||
isProd: appEnv === 'production',
|
isProd: appEnv === 'production',
|
||||||
version: process.env.npm_package_version,
|
version: process.env.npm_package_version,
|
||||||
|
@@ -9,10 +9,6 @@ const levels = {
|
|||||||
debug: 4,
|
debug: 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
const level = () => {
|
|
||||||
return appConfig.appEnv === 'development' ? 'debug' : 'info';
|
|
||||||
};
|
|
||||||
|
|
||||||
const colors = {
|
const colors = {
|
||||||
error: 'red',
|
error: 'red',
|
||||||
warn: 'yellow',
|
warn: 'yellow',
|
||||||
@@ -41,7 +37,7 @@ const transports = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const logger = winston.createLogger({
|
export const logger = winston.createLogger({
|
||||||
level: level(),
|
level: appConfig.logLevel,
|
||||||
levels,
|
levels,
|
||||||
format,
|
format,
|
||||||
transports,
|
transports,
|
||||||
|
@@ -15,13 +15,14 @@ Please be careful with the `ENCRYPTION_KEY` and `WEBHOOK_SECRET_KEY` environment
|
|||||||
:::
|
:::
|
||||||
|
|
||||||
| Variable Name | Type | Default Value | Description |
|
| Variable Name | Type | Default Value | Description |
|
||||||
| --------------------------- | ------- | ------------------ | ---------------------------------------------------- |
|
| --------------------------- | ------- | ------------------ | ---------------------------------------------------------------------------------------------------- |
|
||||||
| `HOST` | string | `localhost` | HTTP Host |
|
| `HOST` | string | `localhost` | HTTP Host |
|
||||||
| `PROTOCOL` | string | `http` | HTTP Protocol |
|
| `PROTOCOL` | string | `http` | HTTP Protocol |
|
||||||
| `PORT` | string | `3000` | HTTP Port |
|
| `PORT` | string | `3000` | HTTP Port |
|
||||||
| `APP_ENV` | string | `production` | Automatisch Environment |
|
| `APP_ENV` | string | `production` | Automatisch Environment |
|
||||||
| `WEB_APP_URL` | string | | Can be used to override connection URLs and CORS URL |
|
| `WEB_APP_URL` | string | | Can be used to override connection URLs and CORS URL |
|
||||||
| `WEBHOOK_URL` | string | | Can be used to override webhook URL |
|
| `WEBHOOK_URL` | string | | Can be used to override webhook URL |
|
||||||
|
| `LOG_LEVEL` | string | `info` | Can be used to configure log level such as `error`, `warn`, `info`, `http`, `debug` |
|
||||||
| `POSTGRES_DATABASE` | string | `automatisch` | Database Name |
|
| `POSTGRES_DATABASE` | string | `automatisch` | Database Name |
|
||||||
| `POSTGRES_SCHEMA` | string | `public` | Database Schema |
|
| `POSTGRES_SCHEMA` | string | `public` | Database Schema |
|
||||||
| `POSTGRES_PORT` | number | `5432` | Database Port |
|
| `POSTGRES_PORT` | number | `5432` | Database Port |
|
||||||
|
Reference in New Issue
Block a user