How Do I Implement Custom Logging?

Q: How Do I Implement Custom Logging?

The Catalog app has a complete code example demonstrating custom logging.

Implement a class derived from ICustomLogger, overriding the various log methods for each log level, Warn, Error, etc. Then assign an instance of it to the PSPDFKit Logger.

Copy
1
2
3
4
5
6
7
8
9
// Set up your own custom logger
var customLogger = new CustomLogger();

// Set it in the PSPDFKit logger
var logger = Logger.Instance;
logger.CustomLogger = customLogger;

// Choose your own log level. Debug is useful for sending reports to us.
logger.CurrentLevel = Level.Debug;