Skip to content

Commit

Permalink
Mod enables ff-loglevel and prepares the logging component
Browse files Browse the repository at this point in the history
  • Loading branch information
jstabenow committed Jun 2, 2024
1 parent 3d02d3a commit 6154b9b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
39 changes: 38 additions & 1 deletion src/misc/modals/Process.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,43 @@ const initLogdata = (logdata) => {
return data;
};

// This requires updating all processes first.

// const loglevel = (level) => {
// switch(level) {
// case 'warning':
// return [
// '[warning]', '[error]', '[debug]', '[trace]',
// ];
// case 'error':
// return [
// '[error]', '[debug]', '[trace]',
// ];
// case 'debug':
// return [
// '[debug]', '[trace]',
// ];
// default:
// return [
// '[info]', '[warning]', '[error]', '[debug]', '[trace]',
// ];
// }
// }

// const filterPrelude = (loglines) => {
// return loglines
// .filter(entry => entry.startsWith('[info]'))
// .map(entry => entry.replace('[info]', ''));
// }

// const filterLoglines = (loglines, level) => {
// return loglines.filter((entry) => {
// return loglevel(level).some((level) => entry[1].includes(level));
// });
// }

const formatLogline = (entry) => {
let line = '@' + entry[0] + ' ';
let line = new Date(entry[0] * 1000).toISOString() + ' ';

const matches = entry[1].match(/^\[([0-9A-Za-z]+) @ 0x[0-9a-f]+\]/i);
if (matches !== null) {
Expand Down Expand Up @@ -107,6 +142,7 @@ const Component = function (props) {
<Typography variant="body1" className={classes.title}>
<Trans>Banner</Trans>
</Typography>
{/* <Textarea rows={9} value={filterPrelude(logdata.prelude).join('\n')} scrollTo="bottom" readOnly allowCopy /> */}
<Textarea rows={9} value={logdata.prelude.join('\n')} scrollTo="bottom" readOnly allowCopy />
</Grid>
<Grid item xs={12} marginTop={2}>
Expand All @@ -116,6 +152,7 @@ const Component = function (props) {
<Typography variant="body1" className={classes.title}>
<Trans>Logging</Trans>
</Typography>
{/* <Textarea rows={16} value={filterLoglines(logdata.log, 'info').map(formatLogline).join('\n')} scrollTo="bottom" readOnly allowCopy /> */}
<Textarea rows={16} value={logdata.log.map(formatLogline).join('\n')} scrollTo="bottom" readOnly allowCopy />
</Grid>
</Grid>
Expand Down
4 changes: 2 additions & 2 deletions src/utils/restreamer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,7 @@ class Restreamer {
reference: channel.channelid,
input: [],
output: [],
options: ['-err_detect', 'ignore_err', ...global],
options: ['-loglevel', 'level+info', '-err_detect', 'ignore_err', ...global],
autostart: control.process.autostart,
reconnect: control.process.reconnect,
reconnect_delay_seconds: parseInt(control.process.delay),
Expand Down Expand Up @@ -2665,7 +2665,7 @@ class Restreamer {
},
],
output: [],
options: ['-err_detect', 'ignore_err', ...global],
options: ['-loglevel', 'level+info', '-err_detect', 'ignore_err', ...global],
autostart: control.process.autostart,
reconnect: control.process.reconnect,
reconnect_delay_seconds: parseInt(control.process.delay),
Expand Down

0 comments on commit 6154b9b

Please sign in to comment.