mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-01 21:13:39 +01:00
Merge pull request #535 from theeternalrat/configurable-logpath
Added configurable setting for log folder
This commit is contained in:
commit
0428914690
@ -4,10 +4,15 @@ import { format as utilFormat } from "node:util";
|
|||||||
|
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
|
|
||||||
|
import checkAndCopyConfig, { getSettings } from "utils/config/config";
|
||||||
|
|
||||||
let winstonLogger;
|
let winstonLogger;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
const configPath = join(process.cwd(), "config");
|
const configPath = join(process.cwd(), "config");
|
||||||
|
checkAndCopyConfig("settings.yaml");
|
||||||
|
const settings = getSettings();
|
||||||
|
const logpath = settings.logpath || configPath;
|
||||||
|
|
||||||
function combineMessageAndSplat() {
|
function combineMessageAndSplat() {
|
||||||
return {
|
return {
|
||||||
@ -57,7 +62,7 @@ function init() {
|
|||||||
winston.format.timestamp(),
|
winston.format.timestamp(),
|
||||||
winston.format.printf(messageFormatter)
|
winston.format.printf(messageFormatter)
|
||||||
),
|
),
|
||||||
filename: `${configPath}/logs/homepage.log`,
|
filename: `${logpath}/logs/homepage.log`,
|
||||||
handleExceptions: true,
|
handleExceptions: true,
|
||||||
handleRejections: true,
|
handleRejections: true,
|
||||||
}),
|
}),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user