Skip to content

Commit 602b00f

Browse files
authored
chore: export types from logger module (#7292)
1 parent f92ebd3 commit 602b00f

File tree

3 files changed

+39
-32
lines changed

3 files changed

+39
-32
lines changed

.changeset/eighty-turkeys-marry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@vue-storefront/sdk": patch
3+
---
4+
5+
Export types from sdk logger module
Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,2 @@
1-
import { LoggerFactory, LoggerType } from "@vue-storefront/logger";
2-
import type { Module } from "../../types";
3-
import type { LoggerModuleConfig } from "./types";
4-
import { injectMetadata } from "./injectMetadata";
5-
import { isInvalidConfig } from "./utils";
6-
7-
export const loggerModule = (options?: LoggerModuleConfig) => {
8-
const logger =
9-
options?.handler ?? LoggerFactory.create(LoggerType.ConsolaGcp, options);
10-
11-
if (isInvalidConfig(options)) {
12-
console.warn(
13-
`Both 'handler' and other config options are provided to logger's configuration.
14-
In such case 'handler' will be used and other options will be ignored as those are
15-
supported only by the built-in logger.
16-
If you want to use other options, please remove 'handler' from the configuration.
17-
If you want to use your handler, please remove other options from the configuration.`
18-
);
19-
}
20-
21-
const loggerWithMetadata = injectMetadata(logger, {
22-
alokai: {
23-
context: "storefront",
24-
},
25-
});
26-
27-
return {
28-
connector: {
29-
...loggerWithMetadata,
30-
},
31-
} satisfies Module;
32-
};
1+
export { loggerModule } from "./module";
2+
export * from "./types";
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { LoggerFactory, LoggerType } from "@vue-storefront/logger";
2+
import type { Module } from "../../types";
3+
import type { LoggerModuleConfig } from "./types";
4+
import { injectMetadata } from "./injectMetadata";
5+
import { isInvalidConfig } from "./utils";
6+
7+
export const loggerModule = (options?: LoggerModuleConfig) => {
8+
const logger =
9+
options?.handler ?? LoggerFactory.create(LoggerType.ConsolaGcp, options);
10+
11+
if (isInvalidConfig(options)) {
12+
console.warn(
13+
`Both 'handler' and other config options are provided to logger's configuration.
14+
In such case 'handler' will be used and other options will be ignored as those are
15+
supported only by the built-in logger.
16+
If you want to use other options, please remove 'handler' from the configuration.
17+
If you want to use your handler, please remove other options from the configuration.`
18+
);
19+
}
20+
21+
const loggerWithMetadata = injectMetadata(logger, {
22+
alokai: {
23+
context: "storefront",
24+
},
25+
});
26+
27+
return {
28+
connector: {
29+
...loggerWithMetadata,
30+
},
31+
} satisfies Module;
32+
};

0 commit comments

Comments
 (0)