diff --git a/backend/mempool-config.sample.json b/backend/mempool-config.sample.json index ea656c1de..d93a326f4 100644 --- a/backend/mempool-config.sample.json +++ b/backend/mempool-config.sample.json @@ -14,7 +14,8 @@ "MEMPOOL_BLOCKS_AMOUNT": 8, "PRICE_FEED_UPDATE_INTERVAL": 3600, "USE_SECOND_NODE_FOR_MINFEE": false, - "EXTERNAL_ASSETS": [] + "EXTERNAL_ASSETS": [], + "STDOUT_LOG_MIN_PRIORITY": "debug" }, "CORE_RPC": { "HOST": "127.0.0.1", diff --git a/backend/src/config.ts b/backend/src/config.ts index 4c2888834..617965d5a 100644 --- a/backend/src/config.ts +++ b/backend/src/config.ts @@ -17,6 +17,7 @@ interface IConfig { PRICE_FEED_UPDATE_INTERVAL: number; USE_SECOND_NODE_FOR_MINFEE: boolean; EXTERNAL_ASSETS: string[]; + STDOUT_LOG_MIN_PRIORITY: 'emerg' | 'alert' | 'crit' | 'err' | 'warn' | 'notice' | 'info' | 'debug'; }; ESPLORA: { REST_API_URL: string; @@ -50,7 +51,7 @@ interface IConfig { ENABLED: boolean; HOST: string; PORT: number; - MIN_PRIORITY: 'emerg' | 'alert' | 'crit' | 'err' |'warn' | 'notice' | 'info' | 'debug'; + MIN_PRIORITY: 'emerg' | 'alert' | 'crit' | 'err' | 'warn' | 'notice' | 'info' | 'debug'; FACILITY: string; }; STATISTICS: { @@ -80,6 +81,7 @@ const defaults: IConfig = { 'PRICE_FEED_UPDATE_INTERVAL': 3600, 'USE_SECOND_NODE_FOR_MINFEE': false, 'EXTERNAL_ASSETS': [], + 'STDOUT_LOG_MIN_PRIORITY': 'debug', }, 'ESPLORA': { 'REST_API_URL': 'http://127.0.0.1:3000', diff --git a/backend/src/logger.ts b/backend/src/logger.ts index 4e8c5ea11..43373e043 100644 --- a/backend/src/logger.ts +++ b/backend/src/logger.ts @@ -97,6 +97,9 @@ class Logger { syslogmsg = `<${(Logger.facilities[config.SYSLOG.FACILITY] * 8 + prionum)}> ${this.name}[${process.pid}]: ${priority.toUpperCase()}${network} ${msg}`; this.syslog(syslogmsg); } + if (Logger.priorities[priority] > Logger.priorities[config.MEMPOOL.STDOUT_LOG_MIN_PRIORITY]) { + return; + } if (priority === 'warning') { priority = 'warn'; }