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