Skip to content

dosymep/Serilog.Sinks.Autodesk.Revit

Repository files navigation

Serilog.Sinks.Autodesk.Revit

JetBrains Rider License MIT Revit 2017-2025 main

Writes Serilog events to Autodesk Revit Journal.

Getting started

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();
}