mirror of
https://github.com/openwrt/luci.git
synced 2026-04-15 10:51:51 +00:00
deploy: ba590f87ea
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
'require poll';
|
||||
'require rpc';
|
||||
'require uci';
|
||||
'require fs';
|
||||
'require ui';
|
||||
'require view';
|
||||
|
||||
@@ -76,7 +77,8 @@ var CBILogreadBox = function(logtag, name) {
|
||||
const tz = uci.get('system', '@system[0]', 'zonename')?.replaceAll(' ', '_');
|
||||
const ts = uci.get('system', '@system[0]', 'clock_timestyle') || 0;
|
||||
const hc = uci.get('system', '@system[0]', 'clock_hourcycle') || 0;
|
||||
const logEntries = await callLogRead(this.fetchMaxRows, false, true);
|
||||
let loglines = await callLogRead(this.fetchMaxRows, false, true)
|
||||
.then((logEntries) => {
|
||||
const dateObj = new Intl.DateTimeFormat(undefined, {
|
||||
dateStyle: 'medium',
|
||||
timeStyle: (ts == 0) ? 'long' : 'full',
|
||||
@@ -84,7 +86,7 @@ var CBILogreadBox = function(logtag, name) {
|
||||
timeZone: tz
|
||||
});
|
||||
|
||||
let loglines = logEntries.map(entry => {
|
||||
return logEntries.map(entry => {
|
||||
const time = new Date(entry?.time);
|
||||
const datestr = dateObj.format(time);
|
||||
/* remember to add one since the 'any' entry occupies 1st position i.e. [0] */
|
||||
@@ -92,6 +94,18 @@ var CBILogreadBox = function(logtag, name) {
|
||||
const severity = this.severity[(entry?.priority % 8) + 1][1] ?? 'unknown';
|
||||
return `[${datestr}] ${facility}.${severity}: ${entry?.msg}`;
|
||||
});
|
||||
})
|
||||
.catch(function (){
|
||||
return Promise.all([
|
||||
L.resolveDefault(fs.stat('/usr/libexec/syslog-wrapper'), null),
|
||||
]).then((stat) => {
|
||||
const logger = stat[0]?.path;
|
||||
return fs.exec_direct(logger)
|
||||
.then(logdata => {
|
||||
return logdata.trim().split(/\n/);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
loglines = loglines.filter(line => {
|
||||
const sevMatch = this.logSeverityFilter === 'any' || line.includes(`.${this.logSeverityFilter}`);
|
||||
|
||||
Reference in New Issue
Block a user