2019-12-05 21:25:36 +01:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const fs = require('fs');
|
2023-11-22 19:34:48 +01:00
|
|
|
const dateUtils = require('../../services/date_utils.js');
|
2024-02-16 21:17:33 +02:00
|
|
|
const {LOG_DIR} = require('../../services/data_dir');
|
2019-12-05 21:25:36 +01:00
|
|
|
|
2020-06-20 12:31:38 +02:00
|
|
|
function getBackendLog() {
|
2019-12-05 21:25:36 +01:00
|
|
|
const file = `${LOG_DIR}/trilium-${dateUtils.localNowDate()}.log`;
|
|
|
|
|
2021-05-25 21:03:00 +02:00
|
|
|
try {
|
|
|
|
return fs.readFileSync(file, 'utf8');
|
|
|
|
}
|
|
|
|
catch (e) {
|
|
|
|
// most probably the log file does not exist yet - https://github.com/zadam/trilium/issues/1977
|
|
|
|
return "";
|
|
|
|
}
|
2019-12-05 21:25:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
getBackendLog
|
2020-06-20 12:31:38 +02:00
|
|
|
};
|