Skip to content

Custom Logs

Overview

Send log messages with customized severity levels, extra data and/or custom labels. Use CoralogixLogSeverity to define severity levels for logs in the Coralogix system.

Note

You can pass any key:value to the extra data object.

CaseRaw valueSeverity level
debug1Debug
verbose2Verbose
info3Informational
warn4Warning
error5Error
critical6Critical

Examples

Custom severity level

CoralogixRum.log(
    CoralogixLogSeverity.Error,
    "Custom log message error"
)

Custom severity level, extra data

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

Direct severity level call, extra data

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

Custom log, extra data and label

CoralogixRum.warning(
  'this is a custom log message with warning severity',
  {
    data: 'tbd',
  },
  {
    my_label_key: 'my label value',
  }
);

Custom severity level, optional extra data (unless label is provided)

The extra data is optional unless labels are specified. If labels are present, extra data becomes required, though it may be set to null if no data is available.

CoralogixRum.log(CoralogixLogSeverity.Info, 'this is a custom log message with info severity', null, {
  my_label_key: 'my label value',
});