mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Table component injection tokens (#7754)
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
1 parent
4b63bc238e
commit
1ffdb6c89f
20 files changed
+167
-18
No files matched your search
@@ -63,7 +63,10 @@ export const logSillyInjectionToken = getInjectionToken<LogFunction>({
|
||||
|
||||
const screamingKebabCase = (str: string) => pipeline(str, kebabCase, toUpper);
|
||||
|
||||
const getLogFunctionFor = (scenario: keyof Logger, namespace: string | undefined) => {
|
||||
const getLogFunctionFor = (
|
||||
scenario: keyof Logger,
|
||||
namespace: string | undefined
|
||||
) => {
|
||||
const prefix = namespace
|
||||
? `[${screamingKebabCase(namespace.replace(/-feature$/, ""))}]: `
|
||||
: "";
|
||||
|
||||
@@ -90,7 +90,6 @@ describe("logger", () => {
|
||||
instantiate: (di) => di.inject(injectionToken),
|
||||
});
|
||||
|
||||
|
||||
const someFeature = getFeature({
|
||||
id: "some-feature",
|
||||
|
||||
@@ -124,11 +123,13 @@ describe("logger", () => {
|
||||
|
||||
registerFeature(di, loggerFeature);
|
||||
|
||||
di.register(getInjectable({
|
||||
id: "some-transport",
|
||||
instantiate: () => new TransportStream({ log }),
|
||||
injectionToken: loggerTransportInjectionToken,
|
||||
}))
|
||||
di.register(
|
||||
getInjectable({
|
||||
id: "some-transport",
|
||||
instantiate: () => new TransportStream({ log }),
|
||||
injectionToken: loggerTransportInjectionToken,
|
||||
})
|
||||
);
|
||||
|
||||
const logger = di.inject(loggerInjectable);
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type TransportStream from "winston-transport";
|
||||
|
||||
export const loggerTransportInjectionToken = getInjectionToken<TransportStream>({
|
||||
id: "logger-transport",
|
||||
});
|
||||
export const loggerTransportInjectionToken = getInjectionToken<TransportStream>(
|
||||
{
|
||||
id: "logger-transport",
|
||||
}
|
||||
);
|
||||
Reference in new issue
Block a user