Skip to content
Chen edited this page Apr 13, 2018 · 4 revisions

WCL uses Microsoft.Extensions.Logging (MEL) as logging infrastructure. However, you can use logging adapters to enable logging with other logging libraries.

Library references

Setup loggers

All the types that implements IWikiClientLoggable interface can be associated with an ILogger instance via Logger property. To enable logging, simply assign it with your logger.

ILoggerFactory loggerFactory = ...;    // Set up your LoggerFactory here.
var client = new WikiClient { Logger =  loggerFactory.CreateLogger("WikiClient") };
var site = new WikiSite("https://en.wikipedia.org/w/api.php") { Logger = loggerFactory.CreateLogger("enwp") };