Merge pull request #114844 from FliegendeWurst/trilium-update
This commit is contained in:
commit
5c6b845e38
@ -3193,6 +3193,12 @@
|
||||
githubId = 19961516;
|
||||
name = "Felix Weilbach";
|
||||
};
|
||||
fliegendewurst = {
|
||||
email = "arne.keller@posteo.de";
|
||||
github = "FliegendeWurst";
|
||||
githubId = 12560461;
|
||||
name = "Arne Keller";
|
||||
};
|
||||
flokli = {
|
||||
email = "flokli@flokli.de";
|
||||
github = "flokli";
|
||||
|
@ -1,17 +1,8 @@
|
||||
From 5be803a1171855f976a5b607970fa3949db72181 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Kampka <christian@kampka.net>
|
||||
Date: Mon, 9 Dec 2019 19:40:27 +0100
|
||||
Subject: [PATCH] Use console logger instead of rolling files
|
||||
|
||||
---
|
||||
src/services/log.js | 26 +++-----------------------
|
||||
1 file changed, 3 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/src/services/log.js b/src/services/log.js
|
||||
index 1514c209..456c3749 100644
|
||||
index b4c39e99..4c249154 100644
|
||||
--- a/src/services/log.js
|
||||
+++ b/src/services/log.js
|
||||
@@ -1,35 +1,15 @@
|
||||
@@ -1,14 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
-const fs = require('fs');
|
||||
@ -21,49 +12,50 @@ index 1514c209..456c3749 100644
|
||||
- fs.mkdirSync(dataDir.LOG_DIR, 0o700);
|
||||
-}
|
||||
-
|
||||
-const logger = require('simple-node-logger').createRollingFileLogger({
|
||||
- errorEventName: 'error',
|
||||
- logDirectory: dataDir.LOG_DIR,
|
||||
- fileNamePattern: 'trilium-<DATE>.log',
|
||||
- dateFormat:'YYYY-MM-DD'
|
||||
-});
|
||||
-let logFile = null;
|
||||
-
|
||||
function info(message) {
|
||||
// info messages are logged asynchronously
|
||||
setTimeout(() => {
|
||||
console.log(message);
|
||||
const SECOND = 1000;
|
||||
const MINUTE = 60 * SECOND;
|
||||
const HOUR = 60 * MINUTE;
|
||||
@@ -16,41 +7,7 @@ const DAY = 24 * HOUR;
|
||||
|
||||
const NEW_LINE = process.platform === "win32" ? '\r\n' : '\n';
|
||||
|
||||
-let todaysMidnight = null;
|
||||
-
|
||||
- logger.info(message);
|
||||
}, 0);
|
||||
-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();
|
||||
- }
|
||||
-}
|
||||
-
|
||||
function log(str) {
|
||||
- const millisSinceMidnight = Date.now() - todaysMidnight.getTime();
|
||||
-
|
||||
- checkDate(millisSinceMidnight);
|
||||
-
|
||||
- logFile.write(formatTime(millisSinceMidnight) + ' ' + str + NEW_LINE);
|
||||
-
|
||||
console.log(str);
|
||||
}
|
||||
|
||||
function error(message) {
|
||||
message = "ERROR: " + message;
|
||||
|
||||
- // we're using .info() instead of .error() because simple-node-logger emits weird error for showError()
|
||||
- // errors are logged synchronously to make sure it doesn't get lost in case of crash
|
||||
- logger.info(message);
|
||||
-
|
||||
console.trace(message);
|
||||
}
|
||||
|
||||
@@ -45,12 +25,12 @@ function request(req) {
|
||||
if (req.url.includes(".js.map") || req.url.includes(".css.map")) {
|
||||
return;
|
||||
}
|
||||
-
|
||||
- logger.info(req.method + " " + req.url);
|
||||
+ if(process.env.DEBUG)
|
||||
+ console.log(req.method + " " + req.url);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
info,
|
||||
error,
|
||||
request
|
||||
-};
|
||||
\ No newline at end of file
|
||||
+};
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
@ -14,21 +14,21 @@ let
|
||||
meta = with lib; {
|
||||
inherit description;
|
||||
homepage = "https://github.com/zadam/trilium";
|
||||
license = licenses.agpl3;
|
||||
license = licenses.agpl3Plus;
|
||||
platforms = [ "x86_64-linux" ];
|
||||
maintainers = with maintainers; [ emmanuelrosa dtzWill ];
|
||||
maintainers = with maintainers; [ fliegendewurst ];
|
||||
};
|
||||
|
||||
version = "0.43.4";
|
||||
version = "0.45.10";
|
||||
|
||||
desktopSource = {
|
||||
url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-${version}.tar.xz";
|
||||
sha256 = "0kjysam5alsmnj93fcqq1ivawnra42gn7dch99rrfmvbkxp7hhr8";
|
||||
sha256 = "06ykgcak7l3q812c4xrp720db3yq0v2lkrzkmwchlwp5rpwhqpck";
|
||||
};
|
||||
|
||||
serverSource = {
|
||||
url = "https://github.com/zadam/trilium/releases/download/v${version}/trilium-linux-x64-server-${version}.tar.xz";
|
||||
sha256 = "128mvmp15mjpb5ipkmr0yn7ahby26shbix3f8q094f4zpxjp83zx";
|
||||
sha256 = "1252zgyb23vfvy63cqd8jdjbm4w9ddwnp32z5vf1fqvd2rrz6lz9";
|
||||
};
|
||||
|
||||
in {
|
||||
@ -95,12 +95,18 @@ in {
|
||||
libxkbfile
|
||||
];
|
||||
|
||||
patches = [ ./0001-Use-console-logger-instead-of-rolling-files.patch ] ;
|
||||
patches = [
|
||||
# patch logger to use console instead of rolling files
|
||||
./0001-Use-console-logger-instead-of-rolling-files.patch
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/bin
|
||||
mkdir -p $out/share/trilium-server
|
||||
|
||||
cp -r ./* $out/share/trilium-server
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
|
Loading…
Reference in New Issue
Block a user