@fordi-org/sdn 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/service/logs.js +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fordi-org/sdn",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Make an npm project run as a systemd service",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
package/service/logs.js CHANGED
@@ -18,11 +18,12 @@ const formatDateTime = (date) => {
18
18
  const t = `${pad(h)}:${pad(date.getMinutes())}:${pad(date.getSeconds())}${a}`;
19
19
  return `${d} ${t}`;
20
20
  }
21
-
21
+ const decoder = new TextDecoder();
22
22
  export const formatJournal = (line) => {
23
23
  const time = parseInt(line.__REALTIME_TIMESTAMP.slice(0, -3));
24
24
  const sym = line._TRANSPORT === 'stdout' ? ' > ' : '‼> ';
25
- return `${formatDateTime(new Date(time))}${sym}${line.MESSAGE}`;
25
+ const message = Array.isArray(line.MESSAGE) ? decoder.decode(new Uint8Array(line.MESSAGE)) : line.MESSAGE;
26
+ return `${formatDateTime(new Date(time))}${sym}${message}`;
26
27
  }
27
28
 
28
29
  export function journalctl() {