File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ class Plugin extends EventEmitter {
1919 this . managers . commands = cmdMgr
2020 }
2121 }
22- this . logger = new Logger ( 'bih' )
22+ this . logger = new Logger ( metadata . main ) ;
2323 this . log = this . logger . log
2424 this . logError = this . logger . logError
2525 }
Original file line number Diff line number Diff line change 11module . exports = class Logger {
2-
32 /**
43 * @param {String } [prefix] The logger prefix
54 */
6- constructor ( prefix = null ) {
7- this . prefix = prefix ;
5+ constructor ( prefix = null ) {
6+ this . prefix = prefix
87 }
98
109 /**
@@ -15,8 +14,8 @@ module.exports = class Logger {
1514 log ( data , error = false ) {
1615 if ( ! data ) return
1716 error
18- ? console . error ( `[ERROR] ${ this . prefix ? `[${ this . prefix } ] ` : "" } ${ data } ` )
19- : console . log ( `[INFO] ${ this . prefix ? `[${ this . prefix } ] ` : "" } ${ data } ` )
17+ ? console . error ( `[ERROR] ${ this . prefix ? `[${ this . prefix } ] ` : '' } ${ data } ` )
18+ : console . log ( `[INFO] ${ this . prefix ? `[${ this . prefix } ] ` : '' } ${ data } ` )
2019 }
2120
2221 /**
@@ -25,16 +24,16 @@ module.exports = class Logger {
2524 */
2625 warn ( data ) {
2726 if ( ! data ) return
28- console . warn ( `[WARN] ${ this . prefix ? `[${ this . prefix } ] ` : "" } ${ data } ` )
27+ console . warn ( `[WARN] ${ this . prefix ? `[${ this . prefix } ] ` : '' } ${ data } ` )
2928 }
3029
3130 /**
3231 * Parse and log an error to the console
33- * @param {Error } error
32+ * @param {Error } error
3433 */
3534 logError ( error ) {
3635 if ( ! error . name ) return
37- this . log ( `${ this . prefix ? `[${ this . prefix } ] ` : "" } ${ error . name } ${ error . message ? `: ${ error . message } ` : ' was thrown.' } ` , true )
36+ this . log ( `${ this . prefix ? `[${ this . prefix } ] ` : '' } ${ error . name } ${ error . message ? `: ${ error . message } ` : ' was thrown.' } ` , true )
3837 if ( error . stack ) console . error ( error . stack )
3938 }
40- }
39+ }
You can’t perform that action at this time.
0 commit comments