@@ -29,14 +29,37 @@ export class Logger implements ReactiveController {
2929 }
3030 }
3131
32+ /* eslint-disable no-console */
33+
34+ /**
35+ * A logging wrapper which checks the debugLog boolean and prints to the console if true.
36+ *
37+ * @example Logger.debug("Hello");
38+ */
39+ static debug ( ...msgs : unknown [ ] ) {
40+ if ( Logger . debugLog ( ) ) {
41+ console . debug ( ...msgs ) ;
42+ }
43+ }
44+
45+ /**
46+ * A logging wrapper which checks the debugLog boolean and prints to the console if true.
47+ *
48+ * @example Logger.info("Hello");
49+ */
50+ static info ( ...msgs : unknown [ ] ) {
51+ if ( Logger . debugLog ( ) ) {
52+ console . info ( ...msgs ) ;
53+ }
54+ }
55+
3256 /**
3357 * A logging wrapper which checks the debugLog boolean and prints to the console if true.
3458 *
3559 * @example Logger.log("Hello");
3660 */
3761 static log ( ...msgs : unknown [ ] ) {
3862 if ( Logger . debugLog ( ) ) {
39- // eslint-disable-next-line no-console
4063 console . log ( ...msgs ) ;
4164 }
4265 }
@@ -47,7 +70,7 @@ export class Logger implements ReactiveController {
4770 * @example Logger.warn("Hello");
4871 */
4972 static warn ( ...msgs : unknown [ ] ) {
50- console . warn ( ...msgs ) ; // eslint-disable-line no-console
73+ console . warn ( ...msgs ) ;
5174 }
5275
5376 /**
@@ -56,7 +79,27 @@ export class Logger implements ReactiveController {
5679 * @example Logger.error("Hello");
5780 */
5881 static error ( ...msgs : unknown [ ] ) {
59- console . error ( [ ...msgs ] . join ( ' ' ) ) ; // eslint-disable-line no-console
82+ console . error ( [ ...msgs ] . join ( ' ' ) ) ;
83+ }
84+
85+ /* eslint-enable no-console */
86+
87+ /**
88+ * Debug logging that outputs the tag name as a prefix automatically
89+ *
90+ * @example this.logger.log("Hello");
91+ */
92+ debug ( ...msgs : unknown [ ] ) {
93+ Logger . debug ( this . prefix , ...msgs ) ;
94+ }
95+
96+ /**
97+ * Info logging that outputs the tag name as a prefix automatically
98+ *
99+ * @example this.logger.log("Hello");
100+ */
101+ info ( ...msgs : unknown [ ] ) {
102+ Logger . info ( this . prefix , ...msgs ) ;
60103 }
61104
62105 /**
@@ -96,6 +139,6 @@ export class Logger implements ReactiveController {
96139 }
97140
98141 hostConnected ( ) {
99- this . log ( 'connected' ) ;
142+ this . debug ( 'connected' ) ;
100143 }
101144}
0 commit comments