refactor: use JsonPrimitive | JsonPrimitive[] instead of JsonValue

Signed-off-by: Thomas Cardonne <thomas.cardonne@adevinta.com>
This commit is contained in:
Thomas Cardonne
2025-09-01 13:45:50 +02:00
parent b6ab2d405d
commit f4045adea0
3 changed files with 12 additions and 6 deletions
@@ -6,7 +6,7 @@
import { config } from 'winston';
import { Format } from 'logform';
import { JsonObject } from '@backstage/types';
import { JsonValue } from '@backstage/types';
import { JsonPrimitive } from '@backstage/types';
import { LoggerService } from '@backstage/backend-plugin-api';
import { RootLoggerService } from '@backstage/backend-plugin-api';
import { ServiceFactory } from '@backstage/backend-plugin-api';
@@ -55,7 +55,7 @@ export type WinstonLoggerLevelOverride = {
// @public (undocumented)
export type WinstonLoggerLevelOverrideMatchers = {
[key: string]: JsonValue | undefined;
[key: string]: JsonPrimitive | JsonPrimitive[] | undefined;
};
// @public (undocumented)
@@ -15,7 +15,11 @@
*/
import { RootConfigService } from '@backstage/backend-plugin-api';
import { JsonObject } from '@backstage/types';
import { RootLoggerConfig, winstonLevels } from './types';
import {
RootLoggerConfig,
winstonLevels,
WinstonLoggerLevelOverrideMatchers,
} from './types';
export const getRootLoggerConfig = (
config: RootConfigService,
@@ -36,7 +40,9 @@ export const getRootLoggerConfig = (
);
}
const matchers = override.getConfig('matchers').get<JsonObject>();
const matchers = override
.getConfig('matchers')
.get<WinstonLoggerLevelOverrideMatchers>();
return {
matchers,
@@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { JsonObject, JsonValue } from '@backstage/types';
import { JsonObject, JsonPrimitive } from '@backstage/types';
import { config as winstonConfig } from 'winston';
/**
* @public
*/
export type WinstonLoggerLevelOverrideMatchers = {
[key: string]: JsonValue | undefined;
[key: string]: JsonPrimitive | JsonPrimitive[] | undefined;
};
/**