Reqlogger exceptions, searchig: search till match percent and search in other subjs

This commit is contained in:
mrfry 2021-01-08 13:44:27 +01:00
parent bf4bdfb249
commit 64f41d6748
5 changed files with 61 additions and 46 deletions

View file

@ -8,10 +8,16 @@ interface Options {
export default function(options: Options): any {
const loggableKeywords = options ? options.loggableKeywords : undefined
const loggableModules = options ? options.loggableModules : undefined
const exceptions = options ? options.exceptions : []
return function(req, res, next) {
res.on('finish', function() {
if (req.url.includes('_next/static')) {
// TODO: test this
const isException = exceptions.some((ex) => {
return req.url.includes(ex)
})
if (isException) {
return
}
@ -26,7 +32,6 @@ export default function(options: Options): any {
console.log(req.headers)
}
// fixme: regexp includes checking
const hasLoggableKeyword =
loggableKeywords &&
loggableKeywords.some((keyword) => {