mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-09 14:58:47 +00:00
Merge branch 'main' of https://github.com/benphelps/homepage
This commit is contained in:
commit
e4c0a62fd9
37 changed files with 406 additions and 116 deletions
|
@ -4,10 +4,15 @@ import { format as utilFormat } from "node:util";
|
|||
|
||||
import winston from "winston";
|
||||
|
||||
import checkAndCopyConfig, { getSettings } from "utils/config/config";
|
||||
|
||||
let winstonLogger;
|
||||
|
||||
function init() {
|
||||
const configPath = join(process.cwd(), "config");
|
||||
checkAndCopyConfig("settings.yaml");
|
||||
const settings = getSettings();
|
||||
const logpath = settings.logpath || configPath;
|
||||
|
||||
function combineMessageAndSplat() {
|
||||
return {
|
||||
|
@ -57,7 +62,7 @@ function init() {
|
|||
winston.format.timestamp(),
|
||||
winston.format.printf(messageFormatter)
|
||||
),
|
||||
filename: `${configPath}/logs/homepage.log`,
|
||||
filename: `${logpath}/logs/homepage.log`,
|
||||
handleExceptions: true,
|
||||
handleRejections: true,
|
||||
}),
|
||||
|
|
|
@ -96,7 +96,7 @@ export async function httpProxy(url, params = {}) {
|
|||
return [status, contentType, data, responseHeaders];
|
||||
}
|
||||
catch (err) {
|
||||
logger.error("Error calling %s//%s%s...", url.protocol, url.hostname, url.pathname);
|
||||
logger.error("Error calling %s//%s%s...", constructedUrl.protocol, constructedUrl.hostname, constructedUrl.pathname);
|
||||
logger.error(err);
|
||||
return [500, "application/json", { error: {message: err?.message ?? "Unknown error", url, rawError: err} }, null];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue