-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use object literal instead of constructor
- Loading branch information
Julien Lengrand-Lambert
authored and
Julien Lengrand-Lambert
committed
May 1, 2018
1 parent
e45afa6
commit 28a1440
Showing
1 changed file
with
14 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
const chalk = require('chalk'); | ||
|
||
var Logger = function(){}; | ||
const Logger = { | ||
log : (...args) =>{ | ||
console.log(...args); | ||
}, | ||
|
||
warn : (...args) =>{ | ||
console.log('⚠️', chalk.yellow.bold(...args)); | ||
}, | ||
|
||
err : (...args) =>{ | ||
console.log('🙀', chalk.red.bold(...args)); | ||
} | ||
|
||
Logger.prototype.log = function(...args) { | ||
console.log(...args); | ||
} | ||
|
||
Logger.prototype.warn = function(...args) { | ||
console.log('\n⚠️', chalk.yellow.bold(...args)); | ||
} | ||
|
||
Logger.prototype.err = function(...args) { | ||
console.log('\n🙀', chalk.red.bold(...args)); | ||
} | ||
}; | ||
|
||
module.exports = { | ||
logger: new Logger() | ||
logger: Logger | ||
} |