about summary refs log tree commit diff
path: root/pkgs/applications/office/trilium/0001-Use-console-logger-instead-of-rolling-files.patch
blob: 7b2635cfe121a803fe19206fe84622d66c0e66f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
diff --git a/src/services/log.js b/src/services/log.js
index 0fcd9812..dcbff070 100644
--- a/src/services/log.js
+++ b/src/services/log.js
@@ -1,15 +1,7 @@
 "use strict";
 
-const fs = require('fs');
-const dataDir = require('./data_dir');
 const cls = require('./cls');
 
-if (!fs.existsSync(dataDir.LOG_DIR)) {
-    fs.mkdirSync(dataDir.LOG_DIR, 0o700);
-}
-
-let logFile = null;
-
 const SECOND = 1000;
 const MINUTE = 60 * SECOND;
 const HOUR = 60 * MINUTE;
@@ -17,38 +9,6 @@ const DAY = 24 * HOUR;
 
 const NEW_LINE = process.platform === "win32" ? '\r\n' : '\n';
 
-let todaysMidnight = null;
-
-initLogFile();
-
-function getTodaysMidnight() {
-    const now = new Date();
-
-    return new Date(now.getFullYear(), now.getMonth(), now.getDate());
-}
-
-function initLogFile() {
-    todaysMidnight = getTodaysMidnight();
-
-    const path = dataDir.LOG_DIR + '/trilium-' + formatDate() + '.log';
-
-    if (logFile) {
-        logFile.end();
-    }
-
-    logFile = fs.createWriteStream(path, {flags: 'a'});
-}
-
-function checkDate(millisSinceMidnight) {
-    if (millisSinceMidnight >= DAY) {
-        initLogFile();
-
-        millisSinceMidnight -= DAY;
-    }
-
-    return millisSinceMidnight;
-}
-
 function log(str) {
     const bundleNoteId = cls.get("bundleNoteId");
 
@@ -56,12 +16,6 @@ function log(str) {
         str = `[Script ${bundleNoteId}] ${str}`;
     }
 
-    let millisSinceMidnight = Date.now() - todaysMidnight.getTime();
-
-    millisSinceMidnight = checkDate(millisSinceMidnight);
-
-    logFile.write(formatTime(millisSinceMidnight) + ' ' + str + NEW_LINE);
-
     console.log(str);
 }