Link to debug file open in log line timestamp

This commit is contained in:
Tulir Asokan 2018-12-05 17:37:25 +02:00
parent c55f0c7840
commit 5337d4d98e

View file

@ -50,10 +50,25 @@ class LogEntry extends PureComponent {
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() {
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")}
</span>
</a>
}
renderLevelName() {
@ -88,10 +103,9 @@ class LogEntry extends PureComponent {
/File "(.+)", line ([0-9]+), in (.+)/g,
(_, file, line, method) => {
fileLinks.push(
<a href={"#/debugOpenFile"} onClick={() => {
api.debugOpenFile(file, line)
return false
}}>File "{file}", line {line}, in {method}</a>,
<a href={`file:///${file}:${line}`} onClick={this.onClickOpen(file, line)}>
File "{file}", line {line}, in {method}
</a>,
)
return "||EDGE||"
})