Closed igoramadas closed 4 years ago
The keepAlive method isn't as reliable because the bunq API doens't provide exact timestamps for the client to try and keep the session alive. So in all my applications I've started using the other variant where it'll simply attempt to create a new session when required.
But to answer your question. It logs directly using this.logger.error( ... )
(found here) at the moment so there is no way to stop that in the current version. I might log the details using a debug/trace level so they can be filtered out more easily or use events to allow for a 'keep-alive-error' event or something along those lines. Will look into it this weekend.
I found that specific part code section, but thought maybe I could do something via ENV variables or so. But just now figured out I can use my own logger interface, so I will try that. Thanks for the quick response!
I understood it as you wanted to log the error but not display the other details. You can use the BUNQ_JS_CLIENT_LOG_LEVEL
to set the error level used by the client awell if you want to disable the logging completely.
I was already setting the BUNQ_JS_CLIENT_LOG_LEVEL. But doesn't help, as I still want to know if something goes wrong. Quick and simple fix, now creating an instance passing my own custom logger:
const customLogger = {
log: obj => {
logger.debug("BunqJSClient", obj)
},
trace: obj => {
logger.debug("BunqJSClient", obj)
},
debug: obj => {
logger.debug("BunqJSClient", obj)
},
info: obj => {
logger.info("BunqJSClient", obj)
},
warn: obj => {
logger.warn("BunqJSClient", obj)
},
error: obj => {
logger.error("BunqJSClient", obj)
}
}
const bunqClient = new BunqJSClient(myFileStore, customLogger)
My logger has a pre-processor that filters out tokens, credentials and general noise from objects.
Can't figure out how to disable axios logging errors to the console on my Node.js app. Mostly 401 errors when token has expired. These started appearing since I changed the keep alive to true - bunqJSClient.setKeepAlive(true).
It logs the full response, leaking all headers including tokens.
Example (omitted the additional error and response properties):
Could someone enlighten me on how to catch these errors myself so I can disable the default console log?