Skip to content

Instantly share code, notes, and snippets.

@vector623
Last active July 12, 2018 14:36
Show Gist options
  • Save vector623/916011088f619e41c8461e8436113561 to your computer and use it in GitHub Desktop.
Save vector623/916011088f619e41c8461e8436113561 to your computer and use it in GitHub Desktop.
format dynamic expando objects with Serilog
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.Destructure.ByTransforming<ExpandoObject>(JsonConvert.SerializeObject)
.WriteTo.AzureAnalytics(
workspaceId: Configuration["AZUREANALYTICS_WORKSPACEID"],
authenticationId: Configuration["AZUREANALYTICS_AUTHENTICATIONID"],
logName: "logTableName",
restrictedToMinimumLevel: LogEventLevel.Debug,
batchSize: 10)
.CreateLogger();
var loggerFactory = new LoggerFactory()
.AddSerilog();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment