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
I start multiple Talkback servers in the same Node script, each handling the requests to a specific backend server.
The code looks something like this:
conststartTalkbackServer=(serverName: string)=>{constoptions={name: serverName,host: config.get<string>(`${serverName}.talkbackUrl`),port: config.get<string>(`${serverName}.talkbackPort`),path: `./talkback/cached_responses/${serverName}`,// ...};constserver=talkback(options);server.start(()=>{console.log(`Talkback server started on http://localhost:${options.port} for ${options.host} with tapes at ${options.path}`);});};['accounts','customers'].forEach(startTalkbackServer);
This works very well. The only issue we have with this, is that the log output from each of the servers does not reflect the server name provided in the options. The log output from both servers have the same name in the log line. This is always the name of the last server started.
For example when the the summary is being printed from these two servers, it looks like this:
and passes in the options of the current handler! So the logger becomes tied to the current handler.
The logger has a method formatMessage that takes only two arguments message and level. I have been overriding formatMessage myself to tweak its output, but I didn't understand why it printed for the wrong handler.
When formatMessage is called there is nothing to differentiate between different handlers so it is not enough to patch it.
I start multiple Talkback servers in the same Node script, each handling the requests to a specific backend server.
The code looks something like this:
This works very well. The only issue we have with this, is that the log output from each of the servers does not reflect the server name provided in the options. The log output from both servers have the same name in the log line. This is always the name of the last server started.
For example when the the summary is being printed from these two servers, it looks like this:
Any idea why this is happening?
The text was updated successfully, but these errors were encountered: