UNPKG

@loglayer/transport-new-relic

Version:

New Relic transport for the LogLayer logging library.

60 lines (59 loc) 2.1 kB
import { HttpTransport, HttpTransportConfig, HttpTransportError, LogSizeError, RateLimitError } from "@loglayer/transport-http"; //#region src/NewRelicTransport.d.ts /** * Error thrown when log entry validation fails. * This includes attribute count, attribute name length, and other New Relic API validations. */ declare class ValidationError extends Error { constructor(message: string); } /** * Configuration options for the New Relic transport. * Extends HttpTransportConfig with New Relic-specific options. */ interface NewRelicTransportConfig extends Omit<HttpTransportConfig, "url" | "headers" | "payloadTemplate"> { /** * The New Relic API key */ apiKey: string; /** * The New Relic Log API endpoint * @default "https://log-api.newrelic.com/log/v1" */ endpoint?: string; /** * Custom payload template function (optional, defaults to New Relic format). * Receives log level, message, and optional data (metadata). */ payloadTemplate?: (params: { logLevel: string; message: string; data?: Record<string, any>; }) => string; } /** * NewRelicTransport is responsible for sending logs to New Relic's Log API. * It extends HttpTransport with New Relic-specific configuration, validation, * and formatting. * * Features: * - Validates attribute count (max 255) * - Validates attribute name length (max 255 characters) * - Truncates attribute values longer than 4094 characters * - Gzip compression by default (via HttpTransport) * - Retry logic with exponential backoff (via HttpTransport) * - Rate limiting support (via HttpTransport) * - Batch sending support (via HttpTransport) * - Error and debug callbacks */ declare class NewRelicTransport extends HttpTransport { /** * Creates a new instance of NewRelicTransport. * * @param config - Configuration options for the transport */ constructor(config: NewRelicTransportConfig); } //#endregion export { HttpTransportError, LogSizeError, NewRelicTransport, type NewRelicTransportConfig, RateLimitError, ValidationError }; //# sourceMappingURL=index.d.mts.map