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.

Case Raw value Severity level
debug 1 Debug
verbose 2 Verbose
info 3 Informational
warn 4 Warning
error 5 Error
critical 6 Critical

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',
});