Skip to content

Latest commit

 

History

History
88 lines (70 loc) · 1.36 KB

logging.md

File metadata and controls

88 lines (70 loc) · 1.36 KB

Logging

You can use our logger functionality for the purpose of debugging.

Non-server client

const client = StreamChat.getInstance('api_key', {
  logger: (logLevel, message, extraData) => {
    console.log(message); // or any logging tool that you are using e.g. reactotron
  },
});

Server side client

const client = StreamChat.getInstance(
  'api_key',
  'secret'
  {
    logger: (logLevel, message, extraData) => {
      console.log(message);
    }
  }
)

extraData contains tags array attached to log message. Tags can have one/many of following values:

  1. api
  2. api_request
  3. api_response
  4. client
  5. channel
  6. connection
  7. event

It may also contains some extra data, some examples have been mentioned below:

{
  "tags": ["api", "api_request", "client"],
  "url": "https://chat.stream-io-api.com/channels",
  "payload": { /** payload */ },
  "config": { /** conig object */ }
}
{
  "tags": ["api", "api_response", "client"],
  "url": "https://chat.stream-io-api.com/channels",
  "response": { /** object */ }
}
{
  "tags": ["api", "api_response", "client"],
  "url": "https://chat.stream-io-api.com/channels",
  "error": { /** error object */ }
}
{
  "tags": ["event", "client"],
  "event": { /** event object */ }
}
{
  "tags": ["channel"],
  "channel": { /** channel object */ }
}