1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00

chore: Add LOG_LEVEL to environment samples

This commit is contained in:
Maksim Eltyshev 2025-04-22 15:41:01 +02:00
parent d9393879b5
commit 728aa901ef
4 changed files with 9 additions and 5 deletions

View file

@ -13,6 +13,8 @@ services:
- DATABASE_URL=postgresql://user:password@postgres:5432/planka_db
- SECRET_KEY=notsecretkey
# - LOG_LEVEL=warn
# - TRUST_PROXY=0
# - TOKEN_EXPIRES_IN=365 # In days

View file

@ -15,6 +15,8 @@ services:
- DATABASE_URL=postgresql://postgres@postgres/planka
- SECRET_KEY=notsecretkey
# - LOG_LEVEL=warn
# - TRUST_PROXY=0
# - TOKEN_EXPIRES_IN=365 # In days

View file

@ -6,6 +6,7 @@ SECRET_KEY=notsecretkey
## Optional
# LOG_LEVEL=warn
# LOG_FILE=
# TRUST_PROXY=0

View file

@ -6,16 +6,13 @@ const winston = require('winston');
*/
const defaultLogTimestampFormat = 'YYYY-MM-DD HH:mm:ss';
const logfile =
'LOG_FILE' in process.env ? process.env.LOG_FILE : `${process.cwd()}/logs/planka.log`;
/**
* Log level for both console and file log sinks.
*
* Refer {@link https://github.com/winstonjs/winston#logging here}
* for more information on Winston log levels.
*/
const logLevel = 'LOG_LEVEL' in process.env ? process.env.LOG_LEVEL : 'warn';
const logLevel = process.env.LOG_LEVEL || 'warn';
const logFormat = winston.format.combine(
winston.format.uncolorize(),
@ -23,13 +20,15 @@ const logFormat = winston.format.combine(
winston.format.printf((log) => `${log.timestamp} [${log.level[0].toUpperCase()}] ${log.message}`),
);
const logFile = process.env.LOG_FILE || `${process.cwd()}/logs/planka.log`;
// eslint-disable-next-line new-cap
const customLogger = new winston.createLogger({
transports: [
new winston.transports.File({
level: logLevel,
format: logFormat,
filename: logfile,
filename: logFile,
}),
new winston.transports.Console({
level: logLevel,