mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 21:00:58 +03:00
added unwanted log urls to prevent logging node-icon api calls
This commit is contained in:
@@ -59,9 +59,6 @@ export class App {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.app = express()
|
this.app = express()
|
||||||
|
|
||||||
// Add the expressRequestLogger middleware to log all requests
|
|
||||||
this.app.use(expressRequestLogger)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async initDatabase() {
|
async initDatabase() {
|
||||||
@@ -92,6 +89,9 @@ export class App {
|
|||||||
// Allow access from *
|
// Allow access from *
|
||||||
this.app.use(cors())
|
this.app.use(cors())
|
||||||
|
|
||||||
|
// Add the expressRequestLogger middleware to log all requests
|
||||||
|
this.app.use(expressRequestLogger)
|
||||||
|
|
||||||
if (process.env.FLOWISE_USERNAME && process.env.FLOWISE_PASSWORD) {
|
if (process.env.FLOWISE_USERNAME && process.env.FLOWISE_PASSWORD) {
|
||||||
const username = process.env.FLOWISE_USERNAME
|
const username = process.env.FLOWISE_USERNAME
|
||||||
const password = process.env.FLOWISE_PASSWORD
|
const password = process.env.FLOWISE_PASSWORD
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ const logger = createLogger({
|
|||||||
* this.app.use(expressRequestLogger)
|
* this.app.use(expressRequestLogger)
|
||||||
*/
|
*/
|
||||||
export function expressRequestLogger(req: Request, res: Response, next: NextFunction): void {
|
export function expressRequestLogger(req: Request, res: Response, next: NextFunction): void {
|
||||||
|
const unwantedLogURLs = ['/api/v1/node-icon/']
|
||||||
|
if (req.url.includes('/api/v1/') && !unwantedLogURLs.some((url) => req.url.includes(url))) {
|
||||||
const fileLogger = createLogger({
|
const fileLogger = createLogger({
|
||||||
format: combine(timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), format.json(), errors({ stack: true })),
|
format: combine(timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), format.json(), errors({ stack: true })),
|
||||||
defaultMeta: {
|
defaultMeta: {
|
||||||
@@ -95,6 +97,7 @@ export function expressRequestLogger(req: Request, res: Response, next: NextFunc
|
|||||||
} else {
|
} else {
|
||||||
fileLogger.http(`${getRequestEmoji(req.method)} ${req.method} ${req.url}`)
|
fileLogger.http(`${getRequestEmoji(req.method)} ${req.method} ${req.url}`)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
next()
|
next()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user