TritonUtils

Overview

The TritonUtils module provides utility functions for stack trace analysis, transaction management, and runtime information capture in the Triton logging framework.

Stack Trace Analysis

isNotTriton(stackTraceLine)

  • Description: Checks if a stack trace line is from internal Triton files

  • Parameters:

    • stackTraceLine: {string} Line from stack trace to check

  • Returns: {boolean} True if the line is NOT from internal Triton files

  • Example:

const isUserCode = isNotTriton('at MyComponent.handleClick (/components/c/myComponent.js:15:10)');

isLWCLine(stackTraceLine)

  • Description: Determines if a stack trace line is from an LWC component

  • Parameters:

    • stackTraceLine: {string} Line from stack trace to check

  • Returns: {boolean} True if the line is from an LWC component

  • Example:

isComponentLine(stackTraceLine)

  • Description: Checks if a stack trace line is from a component (LWC or Aura)

  • Parameters:

    • stackTraceLine: {string} Line from stack trace to check

  • Returns: {boolean} True if the line is from a component

  • Example:

isAuraLine(stackTraceLine)

  • Description: Determines if a stack trace line is from an Aura component

  • Parameters:

    • stackTraceLine: {string} Line from stack trace to check

  • Returns: {boolean} True if the line is from an Aura component

  • Example:

isAura([stack])

  • Description: Determines if a stack trace is from an Aura component

  • Parameters:

    • stack: {string} Optional stack trace to analyze. If not provided, gets current stack trace

  • Returns: {boolean} True if the stack trace contains Aura component references

  • Example:

Transaction Management

generateTransactionId()

  • Description: Generates a UUID v4 (random UUID)

  • Returns: {string} The generated UUID in format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx

  • Example:

Runtime Information

captureRuntimeInfo()

  • Description: Captures comprehensive runtime information about the current environment

  • Returns: {Object} Object containing:

    • Environment info (userAgent, language, platform)

    • Viewport dimensions

    • Theme settings

    • Performance metrics

    • Network info

    • Device info

  • Example:

Component Identification

extractComponentName(componentLine)

  • Description: Extracts the component name from a stack trace line

  • Parameters:

    • componentLine: {string} Stack trace line containing component info

  • Returns: {string} Component name or 'unknown-component' if not found

  • Example:

generateComponentId()

  • Description: Extracts the component identifier from the current stack trace

  • Returns: {string} Component identifier

  • Example:

Performance Metrics

The runtime information capture includes detailed performance metrics:

Network Information

The runtime information capture includes network details:

Device Information

The runtime information capture includes device details:

Last updated