Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(server): improve the display of the start-up information
Elian Doran9779e706c505
diff --git a/apps/server/src/services/utils.ts b/apps/server/src/services/utils.tsindex 78a8891c6f..e2c97103cf 100644--- a/apps/server/src/services/utils.ts+++ b/apps/server/src/services/utils.ts@@ -478,6 +478,9 @@ export function normalizeCustomHandlerPattern(pattern: string | null | undefined}}+export function formatUtcTime(time: string) {+ return time.replace("T", " ").substring(0, 19)+}export default {compareVersions,diff --git a/apps/server/src/www.ts b/apps/server/src/www.tsindex c761af335c..e8ef2a0412 100644--- a/apps/server/src/www.ts+++ b/apps/server/src/www.ts@@ -6,7 +6,7 @@ import config from "./services/config.js";import log from "./services/log.js";import appInfo from "./services/app_info.js";import ws from "./services/ws.js";-import utils from "./services/utils.js";+import utils, { formatUtcTime } from "./services/utils.js";import port from "./services/port.js";import host from "./services/host.js";import buildApp from "./app.js";@@ -19,7 +19,7 @@ const LOGO = `\|_ _| __(_) (_)_ _ _ __ ___ | \\ | | ___ | |_ ___ ___| || '__| | | | | | | '_ \` _ \\ | \\| |/ _ \\| __/ _ \\/ __|| || | | | | | |_| | | | | | | | |\\ | (_) | || __/\\__ \\- |_||_| |_|_|_|\\__,_|_| |_| |_| |_| \\_|\\___/ \\__\\___||___/+ |_||_| |_|_|_|\\__,_|_| |_| |_| |_| \\_|\\___/ \\__\\___||___/ [version]`;export default async function startTriliumServer() {@@ -70,16 +70,7 @@ export default async function startTriliumServer() {(await import("electron")).app.requestSingleInstanceLock();}- log.info(LOGO);- log.info(JSON.stringify(appInfo, null, 2));-- // for perf. issues it's good to know the rough configuration- const cpuInfos = (await import("os")).cpus();- if (cpuInfos && cpuInfos[0] !== undefined) {- // https://github.com/zadam/trilium/pull/3957- const cpuModel = (cpuInfos[0].model || "").trimEnd();- log.info(`CPU model: ${cpuModel}, logical cores: ${cpuInfos.length}, freq: ${cpuInfos[0].speed} Mhz`);- }+ await displayStartupMessage();const httpServer = startHttpServer(app);@@ -92,6 +83,24 @@ export default async function startTriliumServer() {}}+async function displayStartupMessage() {+ log.info("");+ log.info(LOGO.replace("[version]", appInfo.appVersion));+ log.info(`π¦ Versions: app=${appInfo.appVersion} db=${appInfo.dbVersion} sync=${appInfo.syncVersion} clipper=${appInfo.clipperProtocolVersion}`)+ log.info(`π§ Build: ${formatUtcTime(appInfo.buildDate)} (${appInfo.buildRevision.substring(0, 10)})`);+ log.info(`π Data dir: ${appInfo.dataDirectory}`);+ log.info(`β° UTC time: ${formatUtcTime(appInfo.utcDateTime)}`);++ // for perf. issues it's good to know the rough configuration+ const cpuInfos = (await import("os")).cpus();+ if (cpuInfos && cpuInfos[0] !== undefined) {+ // https://github.com/zadam/trilium/pull/3957+ const cpuModel = (cpuInfos[0].model || "").trimEnd();+ log.info(`π» CPU: ${cpuModel} (${cpuInfos.length}-core @ ${cpuInfos[0].speed} Mhz)`);+ }+ log.info("");+}+function startHttpServer(app: Express) {app.set("port", port);app.set("host", host);