11import chalk , { ChalkInstance } from 'chalk' ;
22
3- export type LogLevel = 'log' | 'warn' | 'error' ;
3+ export type LogLevel = 'debug' | ' log' | 'warn' | 'error' ;
44
5+ const Purple = chalk . hex ( '#9900EF' ) ;
56const Gray = chalk . hex ( '#333333' ) ;
67const Green = chalk . hex ( '#57F2A5' ) ;
78const Red = chalk . hex ( '#F93131' ) ;
@@ -18,12 +19,27 @@ export class Logger {
1819 return logger ;
1920 }
2021
22+ /**
23+ * Log a debug message to stdout
24+ * @param args The arguments to log
25+ */
26+ public debug ( ...args : unknown [ ] ) : void {
27+ if ( this . logLevel === 'debug' ) {
28+ this . write ( {
29+ type : 'debug' ,
30+ color : Purple ,
31+ args,
32+ method : console . debug
33+ } ) ;
34+ }
35+ }
36+
2137 /**
2238 * Log a message to stdout
2339 * @param message The message to log
2440 */
2541 public log ( ...args : unknown [ ] ) : void {
26- if ( this . logLevel === 'log' ) {
42+ if ( this . logLevel === 'debug' || this . logLevel === ' log') {
2743 this . write ( {
2844 type : 'log' ,
2945 color : Green ,
@@ -38,7 +54,7 @@ export class Logger {
3854 * @param message The message to log
3955 */
4056 public warn ( ...args : unknown [ ] ) : void {
41- if ( this . logLevel === 'log' || this . logLevel === 'warn' ) {
57+ if ( this . logLevel === 'debug' || this . logLevel === ' log' || this . logLevel === 'warn' ) {
4258 this . write ( {
4359 type : 'warn' ,
4460 color : Orange ,
@@ -53,7 +69,12 @@ export class Logger {
5369 * @param message The message to log
5470 */
5571 public error ( ...args : unknown [ ] ) : void {
56- if ( this . logLevel === 'log' || this . logLevel === 'warn' || this . logLevel === 'error' ) {
72+ if (
73+ this . logLevel === 'debug' ||
74+ this . logLevel === 'log' ||
75+ this . logLevel === 'warn' ||
76+ this . logLevel === 'error'
77+ ) {
5778 this . write ( {
5879 type : 'error' ,
5980 color : Red ,
0 commit comments