{"version":3,"file":"logging.mjs","sources":["../../../../src/services/pluginMeta/logging.ts"],"sourcesContent":["import { type PluginType } from '@grafana/data';\n\nimport { createMonitoringLogger, type MonitoringLogger } from '../../utils/logging';\n\nlet logger: MonitoringLogger;\n\nfunction getLogger() {\n  if (!logger) {\n    logger = createMonitoringLogger('pluginMeta-logs');\n  }\n\n  return logger;\n}\n\nexport function logPluginMetaWarning(message: string, type: PluginType): void {\n  getLogger().logWarning(message, { type });\n  console.warn(message);\n}\n\nexport function logPluginMetaError(message: string, error: unknown): void {\n  getLogger().logError(new Error(message, { cause: error }));\n  console.error(message, error);\n}\n\nexport function setPluginMetaLogger(override: MonitoringLogger) {\n  if (process.env.NODE_ENV !== 'test') {\n    throw new Error('setLogger function can only be called from tests.');\n  }\n\n  logger = override;\n}\n"],"names":[],"mappings":";;;AAIA,IAAI,MAAA;AAEJ,SAAS,SAAA,GAAY;AACnB,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,MAAA,GAAS,uBAAuB,iBAAiB,CAAA;AAAA,EACnD;AAEA,EAAA,OAAO,MAAA;AACT;AAEO,SAAS,oBAAA,CAAqB,SAAiB,IAAA,EAAwB;AAC5E,EAAA,SAAA,EAAU,CAAE,UAAA,CAAW,OAAA,EAAS,EAAE,MAAM,CAAA;AACxC,EAAA,OAAA,CAAQ,KAAK,OAAO,CAAA;AACtB;AAEO,SAAS,kBAAA,CAAmB,SAAiB,KAAA,EAAsB;AACxE,EAAA,SAAA,EAAU,CAAE,SAAS,IAAI,KAAA,CAAM,SAAS,EAAE,KAAA,EAAO,KAAA,EAAO,CAAC,CAAA;AACzD,EAAA,OAAA,CAAQ,KAAA,CAAM,SAAS,KAAK,CAAA;AAC9B;AAEO,SAAS,oBAAoB,QAAA,EAA4B;AAC9D,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,MAAA,EAAQ;AACnC,IAAA,MAAM,IAAI,MAAM,mDAAmD,CAAA;AAAA,EACrE;AAEA,EAAA,MAAA,GAAS,QAAA;AACX;;;;"}