OpenTelemetry SDK
    Preparing search index...

    Interface ReadWriteLogRecord

    A recording of an event. Typically, the record includes a timestamp indicating when the event happened as well as other data that describes what happened, where it happened, etc.

    This interface is not intended to be implemented by users. To produce logs, use Logger#emit. To consume logs, implement LogRecordProcessor#onEmit. ReadWriteLogRecord instances are created and managed by the SDK.

    interface ReadWriteLogRecord {
        attributes: AnyValueMap;
        body?: AnyValue;
        droppedAttributesCount: number;
        eventName?: string;
        hrTime: @opentelemetry/api.HrTime;
        hrTimeObserved: @opentelemetry/api.HrTime;
        instrumentationScope: core.InstrumentationScope;
        resource: resources.Resource;
        severityNumber?: SeverityNumber;
        severityText?: string;
        spanContext?: @opentelemetry/api.SpanContext;
        setAttribute(key: string, value?: AnyValue): logs.ReadWriteLogRecord;
        setAttributes(attributes: AnyValueMap): logs.ReadWriteLogRecord;
        setBody(body: AnyValue): logs.ReadWriteLogRecord;
        setEventName(eventName: string): logs.ReadWriteLogRecord;
        setSeverityNumber(severityNumber: SeverityNumber): logs.ReadWriteLogRecord;
        setSeverityText(severityText: string): logs.ReadWriteLogRecord;
    }
    Index
    attributes: AnyValueMap
    body?: AnyValue
    droppedAttributesCount: number
    eventName?: string
    hrTimeObserved: @opentelemetry/api.HrTime
    instrumentationScope: core.InstrumentationScope

    The instrumentation scope associated with the log record.

    Downstream consumers may group exported records by the identity of this object. If a distinct grouping is required, construct a new scope object instead of reusing an existing one.

    severityNumber?: SeverityNumber
    severityText?: string
    • Sets a single attribute on the log record.

      Parameters

      • key: string

        The attribute key.

      • Optionalvalue: AnyValue

        The attribute value.

      Returns logs.ReadWriteLogRecord

      The updated ReadWriteLogRecord.

    • Sets the event name for the log record.

      Parameters

      • eventName: string

        The event name.

      Returns logs.ReadWriteLogRecord

      The updated ReadWriteLogRecord.

    • Sets the severity text (log level) for the log record.

      Parameters

      • severityText: string

        The severity text.

      Returns logs.ReadWriteLogRecord

      The updated ReadWriteLogRecord.