1 diff --git a/src/services/log.js b/src/services/log.js
2 index a141eae14..094b9381b 100644
3 --- a/src/services/log.js
4 +++ b/src/services/log.js
8 -const fs = require('fs');
9 -const dataDir = require('./data_dir.js');
10 const cls = require('./cls.js');
12 -if (!fs.existsSync(dataDir.LOG_DIR)) {
13 - fs.mkdirSync(dataDir.LOG_DIR, 0o700);
19 const MINUTE = 60 * SECOND;
20 const HOUR = 60 * MINUTE;
21 @@ -17,38 +9,6 @@ const DAY = 24 * HOUR;
23 const NEW_LINE = process.platform === "win32" ? '\r\n' : '\n';
25 -let todaysMidnight = null;
29 -function getTodaysMidnight() {
30 - const now = new Date();
32 - return new Date(now.getFullYear(), now.getMonth(), now.getDate());
35 -function initLogFile() {
36 - todaysMidnight = getTodaysMidnight();
38 - const path = `${dataDir.LOG_DIR}/trilium-${formatDate()}.log`;
44 - logFile = fs.createWriteStream(path, {flags: 'a'});
47 -function checkDate(millisSinceMidnight) {
48 - if (millisSinceMidnight >= DAY) {
51 - millisSinceMidnight -= DAY;
54 - return millisSinceMidnight;
58 const bundleNoteId = cls.get("bundleNoteId");
60 @@ -56,12 +16,6 @@ function log(str) {
61 str = `[Script ${bundleNoteId}] ${str}`;
64 - let millisSinceMidnight = Date.now() - todaysMidnight.getTime();
66 - millisSinceMidnight = checkDate(millisSinceMidnight);
68 - logFile.write(`${formatTime(millisSinceMidnight)} ${str}${NEW_LINE}`);