feat: log registration and removal of plugins

Closes #71
This commit is contained in:
Jovan Krunić
2020-10-26 14:55:56 +01:00
committed by Rainer Killinger
parent 5ff16c1005
commit 006bbebe60

View File

@@ -21,6 +21,7 @@ import {
SCPluginRegisterResponse,
SCPluginRegisterRoute,
} from '@openstapps/core';
import {Logger} from '@openstapps/logger';
import {deepStrictEqual} from 'assert';
import {isTestEnvironment, plugins} from '../common';
import {createRoute} from './route';
@@ -75,6 +76,7 @@ function addPlugin(plugin: SCPluginMetaData): SCPluginRegisterResponse {
}
// it's a new plugin so it can be added to the map of plugins
plugins.set(plugin.route, plugin);
Logger.log(`Registered plugin (name: ${plugin.name}, address: ${plugin.address}) on the route "${plugin.route}".`);
return {success: true};
}
@@ -92,6 +94,7 @@ function removePlugin(route: string): SCPluginRegisterResponse {
}
// remove the plugin information using its route as a key
plugins.delete(route);
Logger.log(`Removed plugin that used the route "${route}".`);
return {success: true};
}