Converter Logging
The DynamicPDF Converter for .NET supports logging through the ConversionOptions
class's static Logging property. Specify the logging level and filepath to set the logging configuration globally for your application.
Logging Level
Logging Level | Description | |
---|---|---|
LogLevel.Complete |
5 | Every log statement is logged. |
LogLevel.Debug |
4 | Full Debug information is logged. |
LogLevel.Error |
1 | Only errors are logged. |
LogLevel.Information |
3 | Useful information, along with warnings and errors is logged. |
LogLevel.None |
0 | No logging. |
LogLevel.Warning |
2 | Warnings and errors are logged. |
Example
ConversionOptions.Logging.Level = LogLevel.Debug;
ConversionOptions.Logging.LogFilePath = logOutputPath;
ConversionOptions.Logging.Level = LogLevel.Debug
ConversionOptions.Logging.LogFilePath = logOutputPath
Logging Identifier
The LogIdentifier enumeration categorizes the log entry source. It is the third entry written to the log. For example, if logging was enabled and converting an HTML document followed by a Word document, the following would appear in the logging output, where Html
identified the logging source was HTML conversion and Word
identified the logging source was Word.
[023160][Information ][Html ] Current session closed...
[023160][Information ][Word ] WordConverter constructor2 called
Log entries have the following possible identifiers.
Logging Identifier | Description | |
---|---|---|
LogIdentifier.Conversion |
2 | Log entry originated from conversion code not specific to any type. |
LogIdentifier.Excel |
5 | Log entry originated from ExcelConverter code. |
LogIdentifier.Html |
7 | Log entry originated from HtmlConverter code. |
LogIdentifier.Image |
8 | Log entry originated from ImageConverter code. |
LogIdentifier.Other |
3 | Log entry originated from other miscellaneous code. |
LogIdentifier.PowerPoint |
6 | Log entry originated from PowerPointConverter code. |
LogIdentifier.Rtf |
10 | Log entry originated from RtfConverter code. |
LogIdentifier.Service |
1 | Log entry originated from service code. |
LogIdentifier.Text |
9 | Log entry originated from TextConverter code. |
LogIdentifier.Visio |
11 | Log entry originated from VisioConverter code. |
LogIdentifier.Word |
4 | Log entry originated from WordConverter code. |
Logger Delegate
Converter's logging also has a LoggerDelegate class that allows defining a delegate to handle logging.
ConversionOptions.Logging.Level = LogLevel.Debug;
ConversionOptions.Logging.LogAction = DelegateMethod;
public static void DelegateMethod(LogIdentifier identifier, LogLevel logLevel, string message)
{
Console.WriteLine(logLevel + "|" + identifier + "|" + message);
}
ConversionOptions.Logging.Level = LogLevel.Debug
ConversionOptions.Logging.LogAction = AddressOf DelegateMethod
Public Shared Sub DelegateMethod(identifier As LogIdentifier, logLevel As LogLevel, message As String)
Console.WriteLine(logLevel.ToString() & "|" & identifier.ToString() & "|" & message)
End Sub