Skip to content

Commit

Permalink
Moves method syntax to ES6
Browse files Browse the repository at this point in the history
  • Loading branch information
qejk committed Apr 26, 2016
1 parent 16264e9 commit 05e7187
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions source/server/winston-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@ const winston = Npm.require('winston');

const WinstonAdapter = Space.Logger.Adapter.extend('Space.Logger.WinstonAdapter', {

Constructor: function(transports) {
Constructor(transports) {
let lib = new winston.Logger({
transports: transports || []
});
lib.setLevels(winston.config.syslog.levels);
this.setLib(lib);
},

addTransport: function() {
addTransport() {
return this._lib.add.apply(this._lib, arguments);
},

removeTransport: function() {
removeTransport() {
return this._lib.remove.apply(this._lib, arguments);
},

hasTransport: function(name) {
hasTransport(name) {
return this._lib.transports[transportName] != null;
},

setMinLevel: function(transportName, levelName) {
setLevel(transportName, levelName) {
if (!this.hasTransport(transportName)) {
throw new Error(this.ERRORS.transportNotAdded(transportName));
}
return this._lib.transports[transportName].level = levelName;
},

ERRORS: {
transportNotAdded: function(transportName) {
transportNotAdded(transportName) {
return `Winston transport with ${transportName} is not added`;
}
}
Expand Down

0 comments on commit 05e7187

Please sign in to comment.