@@ -54,47 +54,43 @@ class Logger {
5454 }
5555 }
5656
57- setFontColor ( ticket ) {
58- if ( ticket in CONFIG . FONT ) {
59- console . log ( CONFIG . FONT [ ticket ] ) ;
60- console . log ( CONFIG . SYSTEM . backToUpLine ) ;
57+ setColor ( ticketObj , text ) {
58+ let colorSetting = '' ;
59+ if ( ticketObj . font in CONFIG . FONT ) {
60+ colorSetting += CONFIG . FONT [ ticketObj . font ] ;
6161 } else {
6262 this . warn ( "Font color not found! Use the default." )
6363 }
64- }
65-
66- setBgColor ( ticket ) {
67- if ( ticket in CONFIG . BACKGROUND ) {
68- console . log ( CONFIG . BACKGROUND [ ticket ] ) ;
69- console . log ( CONFIG . SYSTEM . backToUpLine ) ;
64+ if ( ticketObj . bg in CONFIG . BACKGROUND ) {
65+ colorSetting += CONFIG . BACKGROUND [ ticketObj . bg ]
7066 } else {
71- this . warn ( "Background color not found! Setting not change! " )
67+ this . warn ( "Background color not found! Use the default. " )
7268 }
69+ console . log ( `${ colorSetting } %s${ CONFIG . SYSTEM . reset } ` , text ) ;
7370 }
7471
7572 log ( text ) {
7673 console . log ( text ) ;
7774 }
7875
7976 reset ( ) {
80- console . log ( CONFIG . SYSTEM . reset ) ;
81- console . log ( CONFIG . SYSTEM . backToUpLine ) ;
77+ console . log ( CONFIG . SYSTEM . reset + CONFIG . SYSTEM . backToUpLine ) ;
8278 }
8379
8480 error ( text ) {
85- this . fontColor ( 'red' , `Error : ${ text } ` ) ;
81+ this . fontColor ( 'red' , `ERROR : ${ text } ` ) ;
8682 }
8783
8884 warn ( text ) {
89- this . fontColor ( 'yellow' , `Warning : ${ text } ` ) ;
85+ this . fontColor ( 'yellow' , `WARN : ${ text } ` ) ;
9086 }
9187
9288 info ( text ) {
93- this . fontColor ( 'green' , `Info : ${ text } ` ) ;
89+ this . fontColor ( 'green' , `INFO : ${ text } ` ) ;
9490 }
9591
9692 degug ( text ) {
97- this . fontColor ( 'cyan' , `Debug : ${ text } ` ) ;
93+ this . fontColor ( 'cyan' , `DEBUG : ${ text } ` ) ;
9894 }
9995}
10096
0 commit comments