Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following logging levels are supported:

Level text constantDescription
ERRORErrors only
WARNErrors and warnings
INFOWebSDK functions normal log (default)
DEBUGDebug info
TRACEExecution trace

Push logs to the server

By default, client logs will no be pushed to the server. This feature can be enabled if necessary while API initializing

...

Logging enabling, disabling, level adjusting and pushing logs to the server work for custom logger as well as for default logger.

A separate logger parameters for session, stream or call

Since WebSDK build 2.0.215 it is possible to set a separate logger parameters not only for application, but also for every session, stream or call. In this case, every object uses its own logger instance. For example, let's create a separate custom loggers for stream publishing and playback in Two Way Streaming application:

1. Defaine custom loggers for publishing

Code Block
languagejs
themeRDark
var publishCustomLogger = {
   error: function (text) {
       console.log("publish: ERROR:",text);
   },  
   warn: function (text) {
       console.log("publish: WARN:",text);
   },  
   info: function (text) {
       console.log("publish: INFO:",text);
   },
   debug: function (text) {
       console.log("publish: DEBUG:",text);
   },
   trace: function (text) {
       console.log("publish: TRACE:",text);
   }  
};

and playback

Code Block
languagejs
themeRDark
var playCustomLogger = {
   error: function (text) {
       console.log("play: ERROR:",text);
   },  
   warn: function (text) {
       console.log("play: WARN:",text);
   },  
   info: function (text) {
       console.log("play: INFO:",text);
   },
   debug: function (text) {
       console.log("play: DEBUG:",text);
   },
   trace: function (text) {
       console.log("play: TRACE:",text);
   }  
};

2. Set custom logger option when creating Stream objects for publishing

Code Block
languagejs
themeRDark
function publishStream() {
    ...
    session.createStream({
        name: streamName,
        display: localVideo,
        ...,
        logger: {customLogger: publishCustomLogger}
        ...
    }).publish();
}

and fro playback

Code Block
languagejs
themeRDark
function playStream() {
    ...
    session.createStream({
        name: streamName,
        display: remoteVideo,
        logger: {customLogger: playCustomLogger}
        ...
    }).play();
}

3. The following messages will be displayed in browser xconsole while publishing and playing a stream in modified Two Way Streaming example

Image Added