chore: change most of plugins to use LoggerService
quite a big PR for this but the changes are pretty stright forward. hopefully gets merged before most of these plugins move to the community repository. Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
This commit is contained in:
@@ -9,7 +9,7 @@ import { ExploreTool } from '@backstage/plugin-explore-common';
|
||||
import express from 'express';
|
||||
import { GetExploreToolsRequest } from '@backstage/plugin-explore-common';
|
||||
import { GetExploreToolsResponse } from '@backstage/plugin-explore-common';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import type { ToolDocument as ToolDocument_2 } from '@backstage/plugin-search-backend-module-explore';
|
||||
import { ToolDocumentCollatorFactory as ToolDocumentCollatorFactory_2 } from '@backstage/plugin-search-backend-module-explore';
|
||||
import type { ToolDocumentCollatorFactoryOptions as ToolDocumentCollatorFactoryOptions_2 } from '@backstage/plugin-search-backend-module-explore';
|
||||
@@ -29,7 +29,7 @@ export interface ExploreToolProvider {
|
||||
// @public (undocumented)
|
||||
export interface RouterOptions {
|
||||
// (undocumented)
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
// (undocumented)
|
||||
toolProvider: ExploreToolProvider;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
"express-promise-router": "^4.1.0",
|
||||
"lodash": "^4.17.21",
|
||||
"node-fetch": "^2.6.7",
|
||||
"winston": "^3.2.1",
|
||||
"yn": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
coreServices,
|
||||
createBackendPlugin,
|
||||
@@ -39,7 +38,7 @@ export const explorePlugin = createBackendPlugin({
|
||||
async init({ config, httpRouter, logger }) {
|
||||
httpRouter.use(
|
||||
await createRouter({
|
||||
logger: loggerToWinstonLogger(logger),
|
||||
logger,
|
||||
toolProvider: StaticExploreToolProvider.fromConfig(config),
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { getVoidLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
ExploreTool,
|
||||
GetExploreToolsRequest,
|
||||
@@ -23,6 +22,7 @@ import express from 'express';
|
||||
import request from 'supertest';
|
||||
import { ExploreToolProvider } from '../tools';
|
||||
import { createRouter } from './router';
|
||||
import { mockServices } from '@backstage/backend-test-utils';
|
||||
|
||||
const mockTools: ExploreTool[] = [
|
||||
{ title: 'Tool 1', url: 'https://example.com/tool1', image: '' },
|
||||
@@ -42,7 +42,7 @@ describe('createRouter', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
const router = await createRouter({
|
||||
logger: getVoidLogger(),
|
||||
logger: mockServices.logger.mock(),
|
||||
toolProvider,
|
||||
});
|
||||
app = express().use(router);
|
||||
|
||||
@@ -18,14 +18,14 @@ import { errorHandler } from '@backstage/backend-common';
|
||||
import { GetExploreToolsRequest } from '@backstage/plugin-explore-common';
|
||||
import express from 'express';
|
||||
import Router from 'express-promise-router';
|
||||
import { Logger } from 'winston';
|
||||
import { ExploreToolProvider } from '../tools';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface RouterOptions {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
toolProvider: ExploreToolProvider;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
import { createServiceBuilder } from '@backstage/backend-common';
|
||||
import { GetExploreToolsRequest } from '@backstage/plugin-explore-common';
|
||||
import { Server } from 'http';
|
||||
import { Logger } from 'winston';
|
||||
import { createRouter } from './router';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
export interface ServerOptions {
|
||||
port: number;
|
||||
enableCors: boolean;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
}
|
||||
|
||||
export async function startStandaloneServer(
|
||||
|
||||
Reference in New Issue
Block a user