Skip to content

dosymep/Serilog.Enrichers.Autodesk.Revit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

09eb739 · May 21, 2024

History

22 Commits
May 14, 2024
May 31, 2023
May 21, 2024
May 31, 2023
May 31, 2023
May 14, 2024
May 21, 2024
May 31, 2023
May 31, 2023
May 14, 2024
May 14, 2024
May 14, 2024

Repository files navigation

Serilog.Enrichers.Autodesk.Revit

JetBrains Rider License MIT Revit 2017-2025 main

The Autodesk Revit enrichers for Serilog.

Getting started

Install the Serilog.Enrichers.Autodesk.Revit package from NuGet:

Install-Package Serilog.Enrichers.Autodesk.Revit

Then, apply the enricher to you LoggerConfiguration:

// IExternalCommand.Execute
public Result Execute(ExternalCommandData commandData, 
                      out string message, 
                      ElementSet elements) {
    UIApplication uiApplication = commandData.Application;
    var log = new LoggerConfiguration()
        .Enrich.WithRevitVersion(uiApplication)
        // other enrichers..
        .CreateLogger();
}
// IExternalApplication.Execute
public Result OnStartup(UIControlledApplication application) {
    var log = new LoggerConfiguration()
        .Enrich.WithRevitVersion(application)
        // other enrichers...
        .CreateLogger();
}

Included enrichers

The package includes:

  • WithRevitVersion() - adds Application.VersionNumber or ControlledApplication.VersionNumber
  • WithRevitBuild() - adds Application.VersionBuild or ControlledApplication.VersionBuild
  • WithRevitUserName() - adds Application.Username or ControlledApplication.Username
  • WithRevitLanguage() - adds Application.Language or ControlledApplication.Language
  • WithRevitDocumentTitle() - adds Document.Title
  • WithRevitDocumentPathName() - adds Document.PathName
  • WithRevitDocumentModelPath() - adds Document.GetCloudModelPath() if Document.IsModelInCloud is true or Document.GetWorksharingCentralModelPath() if Document.IsWorkshared is true
  • WithRevitAddinId() - adds Application.ActiveAddinId