mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
fix(core): Reduce logging overhead for levels that do not output (#7479)
all current logging calls execute `callsites()` to figure out what code tried to log. This happens even for logging methods that aren't supposed to create any output. Under moderate load, this can take up quite a lot of resources. This PR changes the logger to make all ignorable logging methods a No-Op. In a small benchmark with a simple webhook, with log-level set to `warn`, and using `ab -c 50 -n 500 http://localhost:5678/webhook/testing`, these were the response times: ### Before  ### After 
This commit is contained in:
committed by
GitHub
parent
0b42d1aa71
commit
76c04815f7
@@ -6,10 +6,7 @@ const { LoggerProxy } = require('n8n-workflow');
|
||||
const { packageDir, writeJSON } = require('./common');
|
||||
const { loadClassInIsolation } = require('../dist/ClassLoader');
|
||||
|
||||
LoggerProxy.init({
|
||||
log: console.log.bind(console),
|
||||
warn: console.warn.bind(console),
|
||||
});
|
||||
LoggerProxy.init(console);
|
||||
|
||||
const loadClass = (sourcePath) => {
|
||||
try {
|
||||
|
||||
@@ -4,10 +4,7 @@ const { LoggerProxy, NodeHelpers } = require('n8n-workflow');
|
||||
const { PackageDirectoryLoader } = require('../dist/DirectoryLoader');
|
||||
const { packageDir, writeJSON } = require('./common');
|
||||
|
||||
LoggerProxy.init({
|
||||
log: console.log.bind(console),
|
||||
warn: console.warn.bind(console),
|
||||
});
|
||||
LoggerProxy.init(console);
|
||||
|
||||
function findReferencedMethods(obj, refs = {}, latestName = '') {
|
||||
for (const key in obj) {
|
||||
|
||||
Reference in New Issue
Block a user