logger.js
364 Bytes
const EventEmitter = require('events');
var url = 'http:mylogger.io/log';
// function in class won't need function keyword
class Logger extends EventEmitter {
log(message) {
// Send an HTTP request
console.log(message);
//Raise an event
this.emit('messageLogged', {id: 1, url: 'http://' });
}
}
module.exports = Logger;