add logging module to make this easier for users but retain custom docs
Signed-off-by: Christopher Diaz <codingdiaz@icloud.com>
This commit is contained in:
committed by
Fredrik Adelöw
parent
21bef93e35
commit
97caf55823
@@ -0,0 +1,39 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend-module-logs': patch
|
||||
---
|
||||
|
||||
Creates a new module to make logging catalog errors simple. This module subscribes to catalog events and logs them.
|
||||
|
||||
Catalog errors are published to the [events plugin](https://github.com/backstage/backstage/tree/master/plugins/events-node): `@backstage/plugin-events-node`. You can subscribe to events and respond to errors, for example you may wish to log them.
|
||||
|
||||
The first step is to add the events backend plugin to your Backstage application. Navigate to your Backstage application directory and add the plugin package.
|
||||
|
||||
```ts
|
||||
# From your Backstage root directory
|
||||
yarn --cwd packages/backend add @backstage/plugin-events-node
|
||||
```
|
||||
|
||||
Now you can install the events backend plugin in your backend.
|
||||
|
||||
```ts title="packages/backend/src/index.ts"
|
||||
backend.add(import('@backstage/plugin-events-backend/alpha'));
|
||||
```
|
||||
|
||||
Install the catalog logs module.
|
||||
|
||||
```ts
|
||||
# From your Backstage root directory
|
||||
yarn --cwd packages/backend add @backstage/plugin-catalog-backend-module-logs
|
||||
```
|
||||
|
||||
Now install the catalog logs module.
|
||||
|
||||
```ts title="packages/backend/src/index.ts"
|
||||
backend.add(import('@backstage/plugin-catalog-backend-module-logs'));
|
||||
```
|
||||
|
||||
You should now see logs as the catalog emits events. Example:
|
||||
|
||||
```
|
||||
[1] 2024-06-07T00:00:28.787Z events warn Policy check failed for user:default/guest; caused by Error: Malformed envelope, /metadata/tags must be array entity=user:default/guest location=file:/Users/foobar/code/backstage-demo-instance/examples/org.yaml
|
||||
```
|
||||
@@ -199,6 +199,15 @@ backend.add(import('@backstage/plugin-events-backend/alpha'));
|
||||
|
||||
If you want to log catalog errors you can install the `@backstage/plugin-catalog-backend-module-logs` module.
|
||||
|
||||
Install the catalog logs module.
|
||||
|
||||
```ts
|
||||
# From your Backstage root directory
|
||||
yarn --cwd packages/backend add @backstage/plugin-catalog-backend-module-logs
|
||||
```
|
||||
|
||||
Add the module to your backend.
|
||||
|
||||
```ts title="packages/backend/src/index.ts"
|
||||
backend.add(import('@backstage/plugin-catalog-backend-module-logs'));
|
||||
```
|
||||
|
||||
@@ -13,6 +13,15 @@ yarn --cwd packages/backend add @backstage/plugin-events-node
|
||||
|
||||
Now you can install the events backend plugin in your backend.
|
||||
|
||||
Install the catalog logs module.
|
||||
|
||||
```ts
|
||||
# From your Backstage root directory
|
||||
yarn --cwd packages/backend add @backstage/plugin-catalog-backend-module-logs
|
||||
```
|
||||
|
||||
Add the module to your backend.
|
||||
|
||||
```ts title="packages/backend/src/index.ts"
|
||||
backend.add(import('@backstage/plugin-events-backend/alpha'));
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user