Writes Serilog events to Autodesk Revit Journal.
Install the Serilog.Sinks.Autodesk.Revit package from NuGet:
Install-Package Serilog.Sinks.Autodesk.Revit
To configure the sink in C# code, call WriteTo.RevitJournal()
during logger configuration:
// IExternalCommand.Execute
public Result Execute(ExternalCommandData commandData,
out string message,
ElementSet elements) {
UIApplication uiApplication = commandData.Application;
var log = new LoggerConfiguration()
.WriteTo.RevitJournal(uiApplication)
.CreateLogger();
}
// IExternalApplication.Execute
public Result OnStartup(UIControlledApplication application) {
var log = new LoggerConfiguration()
.WriteTo.RevitJournal(application)
.CreateLogger();
}