Show notice on error
This commit is contained in:
parent
c4cc1ec73e
commit
0fce63d760
1 changed files with 4 additions and 1 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { Notice } from "obsidian";
|
||||||
|
|
||||||
enum LogLevel {
|
enum LogLevel {
|
||||||
DEBUG,
|
DEBUG,
|
||||||
INFO,
|
INFO,
|
||||||
|
|
@ -6,7 +8,7 @@ enum LogLevel {
|
||||||
}
|
}
|
||||||
|
|
||||||
class LogLine {
|
class LogLine {
|
||||||
constructor(public level: LogLevel, public message: string) {}
|
public constructor(public level: LogLevel, public message: string) {}
|
||||||
|
|
||||||
public toString(): string {
|
public toString(): string {
|
||||||
return `${this.formatLevel()}: ${this.message}`;
|
return `${this.formatLevel()}: ${this.message}`;
|
||||||
|
|
@ -61,6 +63,7 @@ export class Logger {
|
||||||
public error(message: string): void {
|
public error(message: string): void {
|
||||||
this.pushMessage(message, LogLevel.ERROR);
|
this.pushMessage(message, LogLevel.ERROR);
|
||||||
console.error(message);
|
console.error(message);
|
||||||
|
new Notice(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getMessages(): LogLine[] {
|
public getMessages(): LogLine[] {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue