feat: display logs in node management section
This commit is contained in:
parent
22994a4a14
commit
03eed589a9
2
Makefile
2
Makefile
|
@ -238,7 +238,7 @@ DEFAULT_TENOR_API_KEY := DU7DWZ27STB2
|
||||||
TENOR_API_KEY ?= $(DEFAULT_TENOR_API_KEY)
|
TENOR_API_KEY ?= $(DEFAULT_TENOR_API_KEY)
|
||||||
NIM_PARAMS += -d:TENOR_API_KEY:"$(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
|
RESOURCES_LAYOUT := -d:development
|
||||||
|
|
||||||
|
|
|
@ -39,4 +39,7 @@ proc init*(self: NodeController) =
|
||||||
self.view.setStats(StatsSignal(e).stats)
|
self.view.setStats(StatsSignal(e).stats)
|
||||||
self.view.fetchBitsSet()
|
self.view.fetchBitsSet()
|
||||||
|
|
||||||
|
self.status.events.on(SignalType.ChroniclesLogs.event) do(e:Args):
|
||||||
|
self.view.log(ChroniclesLogsSignal(e).content)
|
||||||
|
|
||||||
self.view.init()
|
self.view.init()
|
||||||
|
|
|
@ -200,3 +200,5 @@ QtObject:
|
||||||
QtProperty[int] peerSize:
|
QtProperty[int] peerSize:
|
||||||
read = getPeerSize
|
read = getPeerSize
|
||||||
notify = peerSizeChanged
|
notify = peerSizeChanged
|
||||||
|
|
||||||
|
proc log*(self: NodeView, logContent: string) {.signal.}
|
||||||
|
|
|
@ -30,9 +30,6 @@ proc mainProc() =
|
||||||
|
|
||||||
ensureDirectories(DATADIR, TMPDIR, LOGDIR)
|
ensureDirectories(DATADIR, TMPDIR, LOGDIR)
|
||||||
|
|
||||||
let logFile = fmt"app_{getTime().toUnix}.log"
|
|
||||||
discard defaultChroniclesStream.output.open(LOGDIR & logFile, fmAppend)
|
|
||||||
|
|
||||||
var currentLanguageCode: string
|
var currentLanguageCode: string
|
||||||
|
|
||||||
let fleets =
|
let fleets =
|
||||||
|
@ -138,6 +135,18 @@ proc mainProc() =
|
||||||
defer:
|
defer:
|
||||||
signalsQObjPointer = nil
|
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)
|
var wallet = wallet.newController(status, appService)
|
||||||
defer: wallet.delete()
|
defer: wallet.delete()
|
||||||
engine.setRootContextProperty("walletModel", wallet.variant)
|
engine.setRootContextProperty("walletModel", wallet.variant)
|
||||||
|
|
|
@ -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 {
|
ColumnLayout {
|
||||||
id: messageContainer
|
id: messageContainer
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 077965bf8120364b199af5c6ad3617aaa10734e4
|
Subproject commit 29b80979c6fcedc2e7dccfca109430312944d2c5
|
Loading…
Reference in New Issue