You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I want to change out the adapter host or port for example, using setConfig(), it'll work unless I've logged at least one message. If I have sent a log message, then I have to null out the adapter property for setConfig() to work for the new adapterOptions.
I'm not sure if this wanted behaviour or if setConfig should be nulling the property when adapterOptions is updated. Would you say this is a bug or wanted behaviour?
Example below, just changing port number.
varlog=require("gelf-pro");log.setConfig({adapterOptions: {host: "GraylogServer.lan",port: 10001,family: 4,timeout: 1000,key: fs.readFileSync(`${root}/tls/cert.key`),// tcp-tls onlycert: fs.readFileSync(`${root}/tls/cert.pem`),// tcp-tls only},});log.info(`Should error because wrong port`,{},function(err,bytesSent){if(err){console.log(`Error in log:`,err);}});setTimeout(function(){log.setConfig({adapterOptions: {host: "GraylogServer.lan",port: 10002,family: 4,timeout: 1000,key: fs.readFileSync(`${root}/tls/cert.key`),cert: fs.readFileSync(`${root}/tls/cert.pem`),},});log.adapter=null;// Without this the below will error because it didn't get an updated adapter property, as it's created on first log message from the config provided by setConfig() abovelog.info(`should use 10002 input on the graylog server not 10001`,{},function(err,bytesSent){if(err){console.log(`Error in log:`,err);}});},5000);
The text was updated successfully, but these errors were encountered:
Thx for the detailed issue report. You're absolutely right. I'll address this in the upcoming custom_aliases branch.
This library was initially designed with a cloning concept in mind, utilizing Object.create. However, it seems this approach is not widely adopted. The 1.x branch will maintain the current behavior.
You posted this at a very convenient time, aligning perfectly with the scope of the mentioned branch. kudo.
Hi,
If I want to change out the adapter
host
orport
for example, usingsetConfig()
, it'll work unless I've logged at least one message. If I have sent a log message, then I have to null out the adapter property forsetConfig()
to work for the newadapterOptions
.I'm not sure if this wanted behaviour or if
setConfig
should be nulling the property whenadapterOptions
is updated. Would you say this is a bug or wanted behaviour?Example below, just changing port number.
The text was updated successfully, but these errors were encountered: