{"version":3,"file":"logger.cjs","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;;AAAA,2CAA0E;AAMjE,mGANqB,0BAAkB,OAMrB;AAJ3B,uCAAyC;AAE5B,QAAA,aAAa,GAAG,IAAA,2BAAmB,EAAC,4BAA4B,CAAC,CAAC;AAIlE,QAAA,cAAc,GAAG,YAAY,CAAC;AAC9B,QAAA,YAAY,GAAG,UAAU,CAAC;AAIvC;;;;;;GAMG;AACH,SAAgB,UAAU,CACxB,KAAuB,EACvB,OAAe,EACf,KAAc;IAEd,MAAM,MAAM,GAAG,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,sBAAc,CAAC,CAAC,CAAC,oBAAY,CAAC;IAChE,IAAA,qBAAa,EAAC,GAAG,MAAM,IAAI,OAAO,KAAK,IAAA,sBAAc,EAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAClE,CAAC;AAPD,gCAOC","sourcesContent":["import { createProjectLogger, createModuleLogger } from '@metamask/utils';\n\nimport { toErrorMessage } from './utils';\n\nexport const projectLogger = createProjectLogger('multichain-account-service');\n\nexport { createModuleLogger };\n\nexport const WARNING_PREFIX = 'WARNING --';\nexport const ERROR_PREFIX = 'ERROR --';\n\nexport type Logger = typeof projectLogger;\n\n/**\n * Logs an error with either WARNING or ERROR prefix, appending the error message.\n *\n * @param level - 'warn' for WARNING prefix, 'error' for ERROR prefix.\n * @param message - The static message describing what failed.\n * @param error - The caught error.\n */\nexport function logErrorAs(\n  level: 'warn' | 'error',\n  message: string,\n  error: unknown,\n): void {\n  const prefix = level === 'warn' ? WARNING_PREFIX : ERROR_PREFIX;\n  projectLogger(`${prefix} ${message}: ${toErrorMessage(error)}`);\n}\n"]}