mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-30 06:29:23 +02:00
add extra validation to environment.ts and use os paths
This commit is contained in:
parent
423b091d39
commit
659f578974
5 changed files with 41 additions and 15 deletions
|
@ -1,7 +1,7 @@
|
|||
import "winston-daily-rotate-file";
|
||||
|
||||
import environment from "@server/environment";
|
||||
import * as winston from "winston";
|
||||
import path from "path";
|
||||
|
||||
const hformat = winston.format.printf(
|
||||
({ level, label, message, timestamp, ...metadata }) => {
|
||||
|
@ -27,7 +27,11 @@ const transports: any = [
|
|||
if (environment.SAVE_LOGS) {
|
||||
transports.push(
|
||||
new winston.transports.DailyRotateFile({
|
||||
filename: `${environment.CONFIG_PATH}/logs/pangolin-%DATE%.log`,
|
||||
filename: path.join(
|
||||
environment.CONFIG_PATH,
|
||||
"logs",
|
||||
"pangolin-%DATE%.log",
|
||||
),
|
||||
datePattern: "YYYY-MM-DD",
|
||||
zippedArchive: true,
|
||||
maxSize: "20m",
|
||||
|
@ -38,7 +42,11 @@ if (environment.SAVE_LOGS) {
|
|||
);
|
||||
transports.push(
|
||||
new winston.transports.DailyRotateFile({
|
||||
filename: `${environment.CONFIG_PATH}/logs/.machinelogs-%DATE%.json`,
|
||||
filename: path.join(
|
||||
environment.CONFIG_PATH,
|
||||
"logs",
|
||||
".machinelogs-%DATE%.json",
|
||||
),
|
||||
datePattern: "YYYY-MM-DD",
|
||||
zippedArchive: true,
|
||||
maxSize: "20m",
|
||||
|
@ -46,7 +54,7 @@ if (environment.SAVE_LOGS) {
|
|||
createSymlink: true,
|
||||
symlinkName: ".machinelogs.json",
|
||||
format: winston.format.combine(
|
||||
winston.format.timestamp(),
|
||||
winston.format.timestamp(),
|
||||
winston.format.splat(),
|
||||
winston.format.json(),
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue