mirror of
https://github.com/maubot/maubot.git
synced 2024-10-01 01:06:10 -04:00
Link to debug file open in log line timestamp
This commit is contained in:
parent
c55f0c7840
commit
5337d4d98e
@ -50,10 +50,25 @@ class LogEntry extends PureComponent {
|
|||||||
return this.props.line.msg
|
return this.props.line.msg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClickOpen(path, line) {
|
||||||
|
return () => {
|
||||||
|
if (api.debugOpenFileEnabled()) {
|
||||||
|
api.debugOpenFile(path, line)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderTimeTitle() {
|
||||||
|
return this.props.line.time.toDateString()
|
||||||
|
}
|
||||||
|
|
||||||
renderTime() {
|
renderTime() {
|
||||||
return <span className="time" title={this.props.line.time.toDateString()}>
|
return <a className="time" title={this.renderTimeTitle()}
|
||||||
|
href={`file:///${this.props.line.pathname}:${this.props.line.lineno}`}
|
||||||
|
onClick={this.onClickOpen(this.props.line.pathname, this.props.line.lineno)}>
|
||||||
{this.props.line.time.toLocaleTimeString("en-GB")}
|
{this.props.line.time.toLocaleTimeString("en-GB")}
|
||||||
</span>
|
</a>
|
||||||
}
|
}
|
||||||
|
|
||||||
renderLevelName() {
|
renderLevelName() {
|
||||||
@ -88,10 +103,9 @@ class LogEntry extends PureComponent {
|
|||||||
/File "(.+)", line ([0-9]+), in (.+)/g,
|
/File "(.+)", line ([0-9]+), in (.+)/g,
|
||||||
(_, file, line, method) => {
|
(_, file, line, method) => {
|
||||||
fileLinks.push(
|
fileLinks.push(
|
||||||
<a href={"#/debugOpenFile"} onClick={() => {
|
<a href={`file:///${file}:${line}`} onClick={this.onClickOpen(file, line)}>
|
||||||
api.debugOpenFile(file, line)
|
File "{file}", line {line}, in {method}
|
||||||
return false
|
</a>,
|
||||||
}}>File "{file}", line {line}, in {method}</a>,
|
|
||||||
)
|
)
|
||||||
return "||EDGE||"
|
return "||EDGE||"
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user