Skip to content

Commit

Permalink
Update the log prompt title to include the full date
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongrout committed Oct 31, 2019
1 parent c0ce902 commit 050089e
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions packages/logconsole/src/widget.ts
Expand Up @@ -49,22 +49,35 @@ class LogConsoleOutputPrompt extends Widget implements IOutputPrompt {
* Date & time when output is logged.
*/
set timestamp(value: Date) {
this._timestampNode.innerHTML = value.toLocaleTimeString();
this._timestamp = value;
this._timestampNode.innerHTML = this._timestamp.toLocaleTimeString();
this.update();
}

/**
* Log level
*/
set level(value: FullLogLevel) {
this._level = value;
this.node.dataset.logLevel = value;
this.node.title = `${toTitleCase(value)} message`;
this.update();
}

update() {
if (this._level !== undefined && this._timestamp !== undefined) {
this.node.title = `${this._timestamp.toLocaleString()}; ${toTitleCase(
this._level
)} level`;
}
}

/**
* The execution count for the prompt.
*/
executionCount: nbformat.ExecutionCount;

private _timestamp: Date;
private _level: FullLogLevel;
private _timestampNode: HTMLDivElement;
}

Expand Down

0 comments on commit 050089e

Please sign in to comment.