mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Lotsa typescript bullshit
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
const logger = require('../utils/logger.js')
|
||||
import logger from '../utils/logger'
|
||||
|
||||
module.exports = function(options) {
|
||||
interface Options {
|
||||
loggableKeywords: Array<string>
|
||||
loggableModules: Array<string>
|
||||
}
|
||||
|
||||
export default function(options: Options): any {
|
||||
const loggableKeywords = options ? options.loggableKeywords : undefined
|
||||
const loggableModules = options ? options.loggableModules : undefined
|
||||
|
||||
@@ -24,13 +29,13 @@ module.exports = function(options) {
|
||||
// fixme: regexp includes checking
|
||||
const hasLoggableKeyword =
|
||||
loggableKeywords &&
|
||||
loggableKeywords.some((x) => {
|
||||
return req.url.includes(x)
|
||||
loggableKeywords.some((keyword) => {
|
||||
return req.url.includes(keyword)
|
||||
})
|
||||
const hasLoggableModule =
|
||||
loggableModules &&
|
||||
loggableModules.some((x) => {
|
||||
return hostname.includes(x)
|
||||
loggableModules.some((keyword) => {
|
||||
return hostname.includes(keyword)
|
||||
})
|
||||
const toLog = hasLoggableModule || hasLoggableKeyword
|
||||
|
||||
|
Reference in New Issue
Block a user