Skip to content

Commit fe60a8a

Browse files
committed
feat(logger): add warn
1 parent d432580 commit fe60a8a

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/services/logger.service.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { existsSync, renameSync, writeFileSync } from 'fs';
33
import { basename, dirname, join } from 'path';
44

55
interface LogEntry {
6-
type: 'info' | 'error';
6+
type: 'info' | 'warn' | 'error';
77
timestamp: number;
88
message: string;
99
}
@@ -22,6 +22,14 @@ export class LoggerService {
2222
});
2323
}
2424

25+
warn(message: string): void {
26+
this.addToLog({
27+
type: 'warn',
28+
timestamp: this.getTimestamp(),
29+
message,
30+
});
31+
}
32+
2533
error(message: string): void {
2634
this.addToLog({
2735
type: 'error',
@@ -30,7 +38,7 @@ export class LoggerService {
3038
});
3139
}
3240

33-
get(type: 'all' | 'info' | 'error' = 'all'): LogEntry[] {
41+
get(type: 'all' | 'info' | 'warn' | 'error' = 'all'): LogEntry[] {
3442
if (type === 'all') {
3543
return this.log;
3644
}

0 commit comments

Comments
 (0)