UNPKG

@opentelemetry/winston-transport

Version:
44 lines 1.55 kB
"use strict"; /* * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.OpenTelemetryTransportV3 = void 0; const api_logs_1 = require("@opentelemetry/api-logs"); const TransportStream = require("winston-transport"); /** @knipignore */ const version_1 = require("./version"); const utils_1 = require("./utils"); class OpenTelemetryTransportV3 extends TransportStream { _logger; constructor(options) { super(options); this._logger = api_logs_1.logs.getLogger(version_1.PACKAGE_NAME, version_1.PACKAGE_VERSION); } log(info, callback) { try { (0, utils_1.emitLogRecord)(info, this._logger); } catch (error) { this.emit('warn', error); } this.emit('logged', info); if (callback) { callback(); } } } exports.OpenTelemetryTransportV3 = OpenTelemetryTransportV3; //# sourceMappingURL=OpenTelemetryTransportV3.js.map