Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
v1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
onechiporenko committed Nov 9, 2018
1 parent 9e7331d commit 57cf577
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
6 changes: 4 additions & 2 deletions lib/express.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import winston = require('winston');

const logger = winston.createLogger({
level: 'info',
transports: [new winston.transports.Console()],
transports: new winston.transports.Console({
format: winston.format.simple(),
}),
});

// from https://github.com/expressjs/express/issues/3308#issuecomment-300957572
Expand All @@ -13,7 +15,7 @@ export function printRoutesMap(path, layer) {
} else if (layer.name === 'router' && layer.handle.stack) {
layer.handle.stack.forEach(printRoutesMap.bind(null, path.concat(split(layer.regexp))));
} else if (layer.method) {
logger.info(`${layer.method.toUpperCase()} ${path.concat(split(layer.regexp)).filter(Boolean).join('/')}`);
logger.info({level: 'info', message: `${layer.method.toUpperCase()} ${path.concat(split(layer.regexp)).filter(Boolean).join('/')}`});
}
}

Expand Down
9 changes: 6 additions & 3 deletions lib/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ export default class Server {
this.expressLairRouter = express.Router();
this.lair = Lair.getLair();
this.logger = winston.createLogger({
transports: [new winston.transports.Console()],
level: 'info',
transports: [new winston.transports.Console({
format: winston.format.simple(),
})],
});
}

Expand Down Expand Up @@ -169,7 +172,7 @@ export default class Server {
app.use(bodyParser.json());
app.use((req, res, next) => {
if (this.verbose) {
this.logger.info(colors.green(`${req.method} ${req.url}`));
this.logger.info({level: 'info', message: colors.green(`${req.method} ${req.url}`)});
}
next();
});
Expand All @@ -186,7 +189,7 @@ export default class Server {

private printRoutesMap() {
if (this.verbose) {
this.logger.info('Defined route-handlers');
this.logger.info({level: 'info', message: 'Defined route-handlers'});
this.expressApp._router.stack.forEach(printRoutesMap.bind(null, []));
}
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swarm-host",
"version": "1.4.1",
"version": "1.4.2",
"description": "fake-server",
"main": "dist/index.js",
"typings": "./dist/index.d.ts",
Expand Down

0 comments on commit 57cf577

Please sign in to comment.