-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(middleware): add support for Express
- Loading branch information
1 parent
b8b7b95
commit feb7083
Showing
10 changed files
with
399 additions
and
21 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,3 +1,4 @@ | ||
*.spec.js | ||
node_modules | ||
.idea | ||
examples |
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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
const express = require('express'); | ||
const logFactory = require('../index'); | ||
const logger = logFactory('example'); | ||
const port = 3000; | ||
|
||
const app = express(); | ||
|
||
app.use(logFactory.getExpressMiddleware()); | ||
|
||
app.get('/', (req, res) => { | ||
logger.info('before'); | ||
|
||
logFactory.setOnContext('customer_id', Math.round(Math.random() * 1000)); | ||
|
||
logger.info('after'); | ||
res.send('It works') | ||
}); | ||
|
||
app.listen(port); | ||
console.log('listening on port: ' + port); |
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
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
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
Oops, something went wrong.