about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/office/trilium/0001-Use-console-logger-instead-of-rolling-files.patch
blob: 5bda63b58451f2a2609de956d1e0076fc918139e (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
diff --git a/src/services/log.js b/src/services/log.js
index 1345ce39..a9770516 100644
--- a/src/services/log.js
+++ b/src/services/log.js
@@ -1,14 +1,5 @@
 "use strict";
 
-const fs = require('fs');
-const dataDir = require('./data_dir');
-
-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;
@@ -16,45 +7,7 @@ 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) {
-    let millisSinceMidnight = Date.now() - todaysMidnight.getTime();
-
-    millisSinceMidnight = checkDate(millisSinceMidnight);
-
-    logFile.write(formatTime(millisSinceMidnight) + ' ' + str + NEW_LINE);
-
     console.log(str);
 }