Is there a way to turn off "noisy" logging?

Good morning. Hope you guys had a great New Year's and a merry Christmas, happy Hanukkah or whatever holidays you may celebrate. :smiley: Great to be back for 2023!

So I need to use console.log, but in order to do that I have to filter through a never-ending stream of logging - every little thing the SDK does internally gets logged, to the extreme. This would be an awesome feature if I knew the SDK's code base inside-out-and-backwards, or if it were not minified so I could see what's generating all these logs). I'm currently working around this issue by sending XHRs to my server and writing to text files. But it would be nice if there were a way to turn Loggoholic Mode on or off. Just a thought :laughing:

If there isn't... how do you guys recommend we do our own logging? I'm sure I'm not the first to ask something like this. Thanks in advance. :slight_smile:

Hey Mike,

Unfortunately there's no easy way to turn off the SDK's console logging entirely.

I think the best approach would be to pass in your own logger altogether. You should be able to pass in your own logger and just override the log functions (info, warn, error, debug, etc). A bit more information about that here. The SDK automatically defaults logs to console.logLevel if a logger isn't passed into the config.

A simpler approach would be to specify what level you'd like the logs to default to when configuring the SDK. Specifying a logLevel in your config here may make it a bit easier to filter and find what you're looking for.

We tend to er on the side of more logging because it just makes it easier to debug conversation/conference errors from customers but you admittedly bring up a great point. I'll discuss with the team about adding an optional config option to the SDK for turning off some of these logs.

Hope this info helps, let me know if you have any questions!

-Zach

For the record, if you change the logLevel it will also affect the logs that get sent to genesys and may limit our ability to troubleshoot calls in the future.

Awesome! Glad I could be of help to you guys. You've certainly helped me a lot. :smiley:

I will try the custom logger idea, because yeah I don't want to mess with what logs get sent to whatever logging systems you guys have on the back-end. Obviously, if something goes wrong to the point where I'd need to submit a ticket, then we'll need you guys to have all the info you can get. :slight_smile:

This should be as easy as

const customLogger = {
  log: () => {},
  debug: () => {},
  info: () => {},
  warn: () => {},
  error: () => {}
};
const sdk = new GenesysCloudWebrtcSdk({
  logger: customLogger,
  ...
});

Bingo! Works like a charm! I had no idea it could do that. What's nice about this too is, if I decide later on that I want some of that extra logging, I can always change it later. Thank you! :smiley:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.