-
-
Notifications
You must be signed in to change notification settings - Fork 4
Logging
Oddbjørn Bakke edited this page May 17, 2021
·
2 revisions
The SDK uses ILogger/ILoggerFactory
abstractions, you might set this or not use it at all.
But if you want logs, you will need to provide some logger to the SDK with this abstraction.
- Add the
serviceCollection.AddTouchPortalSdk(configurationRoot);
and the resolve throughITouchPortalClientFactory
. - Or provide and ILoggerFactory interface on the
TouchPortalFactory
, ex.TouchPortalFactory.CreateClient(this, loggerFactory: loggerFactory);
public class SamplePlugin
{
string ITouchPortalEventHandler.PluginId => "Sample.Plugin";
private readonly ITouchPortalClient _client;
public SamplePlugin(ITouchPortalClientFactory touchPortalClientFactory)
{
//This factory needs 'serviceCollection.AddTouchPortalSdk(configurationRoot);' to work:
_client = touchPortalClientFactory.CreateClient(this)
//or:
_client = TouchPortalFactory.CreateClient(this, loggerFactory: loggerFactory);
}
}
If the log contains to much noise from the SDK, add the TouchPortalSDK
section with Warning
or Error
level.
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"TouchPortalSDK" : "Warning"
}
}
}
- Home
- Development
- Getting started
- TODO: Entry.tp
- TODO: Commands
- TODO: Events
- Logging
- Parallelization
- TODO: Graphics / Images
- TODO: Plugins with GUI
- Create a .tpp package
- TODO: Creating a installer
- Troubleshooting
- How the SDK works
- Other SDKs