diff --git a/.changeset/eighty-turkeys-marry.md b/.changeset/eighty-turkeys-marry.md new file mode 100644 index 0000000000..8c4f674487 --- /dev/null +++ b/.changeset/eighty-turkeys-marry.md @@ -0,0 +1,5 @@ +--- +"@vue-storefront/sdk": patch +--- + +Export types from sdk logger module diff --git a/packages/sdk/src/modules/loggerModule/index.ts b/packages/sdk/src/modules/loggerModule/index.ts index 84a8ed4b10..b2766be50c 100644 --- a/packages/sdk/src/modules/loggerModule/index.ts +++ b/packages/sdk/src/modules/loggerModule/index.ts @@ -1,32 +1,2 @@ -import { LoggerFactory, LoggerType } from "@vue-storefront/logger"; -import type { Module } from "../../types"; -import type { LoggerModuleConfig } from "./types"; -import { injectMetadata } from "./injectMetadata"; -import { isInvalidConfig } from "./utils"; - -export const loggerModule = (options?: LoggerModuleConfig) => { - const logger = - options?.handler ?? LoggerFactory.create(LoggerType.ConsolaGcp, options); - - if (isInvalidConfig(options)) { - console.warn( - `Both 'handler' and other config options are provided to logger's configuration. - In such case 'handler' will be used and other options will be ignored as those are - supported only by the built-in logger. - If you want to use other options, please remove 'handler' from the configuration. - If you want to use your handler, please remove other options from the configuration.` - ); - } - - const loggerWithMetadata = injectMetadata(logger, { - alokai: { - context: "storefront", - }, - }); - - return { - connector: { - ...loggerWithMetadata, - }, - } satisfies Module; -}; +export { loggerModule } from "./module"; +export * from "./types"; diff --git a/packages/sdk/src/modules/loggerModule/module.ts b/packages/sdk/src/modules/loggerModule/module.ts new file mode 100644 index 0000000000..84a8ed4b10 --- /dev/null +++ b/packages/sdk/src/modules/loggerModule/module.ts @@ -0,0 +1,32 @@ +import { LoggerFactory, LoggerType } from "@vue-storefront/logger"; +import type { Module } from "../../types"; +import type { LoggerModuleConfig } from "./types"; +import { injectMetadata } from "./injectMetadata"; +import { isInvalidConfig } from "./utils"; + +export const loggerModule = (options?: LoggerModuleConfig) => { + const logger = + options?.handler ?? LoggerFactory.create(LoggerType.ConsolaGcp, options); + + if (isInvalidConfig(options)) { + console.warn( + `Both 'handler' and other config options are provided to logger's configuration. + In such case 'handler' will be used and other options will be ignored as those are + supported only by the built-in logger. + If you want to use other options, please remove 'handler' from the configuration. + If you want to use your handler, please remove other options from the configuration.` + ); + } + + const loggerWithMetadata = injectMetadata(logger, { + alokai: { + context: "storefront", + }, + }); + + return { + connector: { + ...loggerWithMetadata, + }, + } satisfies Module; +};