CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
ProxyLogger.js48 linesDownload Raw Back to esm
1/*2 * Copyright The OpenTelemetry Authors3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 *      https://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16import { NOOP_LOGGER } from './NoopLogger';17export class ProxyLogger {18    constructor(_provider, name, version, options) {19        this._provider = _provider;20        this.name = name;21        this.version = version;22        this.options = options;23    }24    /**25     * Emit a log record. This method should only be used by log appenders.26     *27     * @param logRecord28     */29    emit(logRecord) {30        this._getLogger().emit(logRecord);31    }32    /**33     * Try to get a logger from the proxy logger provider.34     * If the proxy logger provider has no delegate, return a noop logger.35     */36    _getLogger() {37        if (this._delegate) {38            return this._delegate;39        }40        const logger = this._provider.getDelegateLogger(this.name, this.version, this.options);41        if (!logger) {42            return NOOP_LOGGER;43        }44        this._delegate = logger;45        return this._delegate;46    }47}48//# sourceMappingURL=ProxyLogger.js.map
basant307/AI_Governance_Project · CoolFace