diff --git a/Makefile b/Makefile index 0bde41b5f0..b28faa5492 100644 --- a/Makefile +++ b/Makefile @@ -238,7 +238,7 @@ DEFAULT_TENOR_API_KEY := DU7DWZ27STB2 TENOR_API_KEY ?= $(DEFAULT_TENOR_API_KEY) NIM_PARAMS += -d:TENOR_API_KEY:"$(TENOR_API_KEY)" -NIM_PARAMS += -d:chronicles_sinks="textlines[stdout],textlines[nocolors,file]" +NIM_PARAMS += -d:chronicles_sinks=textlines[stdout],textlines[nocolors,dynamic],textlines[file,nocolors] -d:chronicles_runtime_filtering=on -d:chronicles_default_output_device=dynamic RESOURCES_LAYOUT := -d:development diff --git a/src/app/node/core.nim b/src/app/node/core.nim index 0c55aba75c..66e2d1610d 100644 --- a/src/app/node/core.nim +++ b/src/app/node/core.nim @@ -39,4 +39,7 @@ proc init*(self: NodeController) = self.view.setStats(StatsSignal(e).stats) self.view.fetchBitsSet() + self.status.events.on(SignalType.ChroniclesLogs.event) do(e:Args): + self.view.log(ChroniclesLogsSignal(e).content) + self.view.init() diff --git a/src/app/node/view.nim b/src/app/node/view.nim index f3586d50a1..b2c14419f9 100644 --- a/src/app/node/view.nim +++ b/src/app/node/view.nim @@ -200,3 +200,5 @@ QtObject: QtProperty[int] peerSize: read = getPeerSize notify = peerSizeChanged + + proc log*(self: NodeView, logContent: string) {.signal.} diff --git a/src/nim_status_client.nim b/src/nim_status_client.nim index 3873f5c6bb..9f80e1857e 100644 --- a/src/nim_status_client.nim +++ b/src/nim_status_client.nim @@ -30,9 +30,6 @@ proc mainProc() = ensureDirectories(DATADIR, TMPDIR, LOGDIR) - let logFile = fmt"app_{getTime().toUnix}.log" - discard defaultChroniclesStream.output.open(LOGDIR & logFile, fmAppend) - var currentLanguageCode: string let fleets = @@ -138,6 +135,18 @@ proc mainProc() = defer: signalsQObjPointer = nil + when compiles(defaultChroniclesStream.output.writer): + defaultChroniclesStream.output.writer = + proc (logLevel: LogLevel, msg: LogOutputStr) {.gcsafe, raises: [Defect].} = + try: + if signalsQObjPointer != nil: + signal_handler(signalsQObjPointer, ($(%* {"type": "chronicles-log", "event": msg})).cstring, "receiveSignal") + except: + logLoggingFailure(cstring(msg), getCurrentException()) + + let logFile = fmt"app_{getTime().toUnix}.log" + discard defaultChroniclesStream.outputs[1].open(LOGDIR & logFile, fmAppend) + var wallet = wallet.newController(status, appService) defer: wallet.delete() engine.setRootContextProperty("walletModel", wallet.variant) diff --git a/ui/app/AppLayouts/Node/NodeLayout.qml b/ui/app/AppLayouts/Node/NodeLayout.qml index 51c6f2ca9f..5dad81b7a2 100644 --- a/ui/app/AppLayouts/Node/NodeLayout.qml +++ b/ui/app/AppLayouts/Node/NodeLayout.qml @@ -69,6 +69,39 @@ Item { } } + ColumnLayout { + id: logContainer + height: 300 + StyledText { + id: logHeaderDesc + color: Style.current.lightBlueText + text: "Logs:" + Layout.rightMargin: Style.current.padding + Layout.leftMargin: Style.current.padding + Layout.fillWidth: true + font.weight: Font.Medium + font.pixelSize: 20 + } + StyledTextArea { + id: logsTxt + text: "" + customHeight: 200 + textField.readOnly: true + } + + Connections { + target: nodeModel + function onLog(logContent) { + let lines = logsTxt.text.split("\n"); + if (lines.length > 5){ + lines.shift(); + } + lines.push(logContent.trim()) + logsTxt.text = lines.join("\n") + } + } + } + ColumnLayout { id: messageContainer Layout.fillHeight: true diff --git a/vendor/status-lib b/vendor/status-lib index 077965bf81..29b80979c6 160000 --- a/vendor/status-lib +++ b/vendor/status-lib @@ -1 +1 @@ -Subproject commit 077965bf8120364b199af5c6ad3617aaa10734e4 +Subproject commit 29b80979c6fcedc2e7dccfca109430312944d2c5