Control debug/logs using API rather browser localStorage

Mediasoup uses the browser localStorage to set the log level. IMHO it’s not good for a library to directly access the local storage and I rather prefer to set the log level via my app and using the API.

OTOH using the global debug key without namespace may conflict with other apps/tools.

mediasoup-client does not use localStorage. It’s the debug module used by mediasoup-client the one who uses it. And the debug module is widely used by many other browser and Node JS libs. It’s configurable, flexible and very efficient.

This is not gonna change for now. I see no reason for that.

If you really want there’s things like https://github.com/johngodley/webpack-remove-debug that you can plug-in to your build system.

I need a way to collect user log messages in the server for bug tracking purposes so I should be able to enable the debug for the remote client on demand via the app, not local storage.

BTW one big problem with debug module is that it does not support for printing function name and line number in the browser.

I think there is a confusion here. Logs provided by mediasoup-client are just those: logs produced by mediasoup-client. They are not intended for the application to inspect them. Your app can produce logs or send them to the server or whatever.

I strongly think that what you are asking for just satisfies your specific app needs. IMHO, your app should be interested in collecting stats and so on, and transmitting them to your server if you wish to inspect/store them. The logs produced by a client side library are just that, internal logs that print some information, nothing else.

Some times we need to diagnose user issue by inspecting client logs but you are right, the logs produced by mediasoup-client would not help much in this case.

Thanks for your advice :ok_hand:.