# Logs and errors

Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fuser-guides%2Frum%2Fsdk-installation%2Fjavascript%2Fbrowser-sdk%2Ffeatures%2Flogs-and-errors.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fuser-guides%2Frum%2Fsdk-installation%2Fjavascript%2Fbrowser-sdk%2Ffeatures%2Flogs-and-errors.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

### Sending Custom Logs[​](#sending-custom-logs "Direct link to Sending Custom Logs")

```
import { CoralogixRum, CoralogixLogSeverity } from '@coralogix/browser';



// send custom logs with different severity levels

CoralogixRum.log(CoralogixLogSeverity.Info, 'this is a custom log');



// send custom logs with extra data

CoralogixRum.log(CoralogixLogSeverity.Error, 'this is an error custom log with extra data', { data: 'tbd' });



// send custom logs with extra data, call the error severity log directly

CoralogixRum.error('this is a custom log with error severity', { data: 'tbd' });



// send custom logs with extra data and labels

CoralogixRum.warning(

  'this is a custom log message with warning severity',

  {

    data: 'tbd',

  },

  {

    my_label_key: 'my label value',

  }

);



// data is optional unless labels are provided, in which case data is required (can be null

CoralogixRum.log(CoralogixLogSeverity.Info, 'this is a custom log message with info severity', null, {

  my_label_key: 'my label value',

});
```

### Instrumentation's[​](#instrumentations "Direct link to Instrumentation's")

Turn on/off specific instrumentation, default to all trues. Each instrumentation is responsible for which data the SDK will track and collect for you.

```
CoralogixRum.init({

  // ...

  instrumentations: {

    xhr: true,

    fetch: true,

    web_vitals: false,

    interactions: false,

    custom: true,

    errors: true,

    long_tasks: true,

    resources: false,

  },

});
```

##### Web Vitals: TBT metric[​](#web-vitals-tbt-metric "Direct link to Web Vitals: TBT metric")

By default, the **TBT** (Total Blocking Time) metric is disabled. To enable it, explicitly configure it as shown below:

```
{

  "instrumentations": {

    "web_vitals": {

      "enabled": true,

      "metrics": {

        "tbt": true

      }

    }

  }

}
```

### Manually Capture Errors[​](#manually-capture-errors "Direct link to Manually Capture Errors")

You can pass an Error object to capture it as an event.<br />Additionally, you can include custom data and labels with the event.

```
try {

  // Some code that might throw an error

} catch (error) {

  CoralogixRum.captureError(error);



  CoralogixRum.captureError(error, { custom_data: { id: '123' } }); // add custom data



  CoralogixRum.captureError(error, { custom_data: { id: '123' } }, { label1: 'value1' }); // add custom data and labels

}
```
