Skip to content

Instantly share code, notes, and snippets.

@sirkirby
Last active October 7, 2017 01:36
Show Gist options
  • Save sirkirby/53aed2328d556854008eb1a3c5306cd3 to your computer and use it in GitHub Desktop.
Save sirkirby/53aed2328d556854008eb1a3c5306cd3 to your computer and use it in GitHub Desktop.
Sending a custom event grid log through serilog event grid sink
// using the ILogger Event extension methods
Logger.Event("import", $"myApp/myLogic/customRecord", "Processing completed {@recordCount}", records.Count);
Log.EventType("import", "Processing completed {@recordCount}", records.Count);
Log.EventSubject("myApp/myLogic/customRecord", "Processing completed {@recordCount}", records.Count);
// use attributes
[EventGridSubject("myApp/myLogic/customRecord")]
public class MyImportClass
{
[EventGridType("import")]
public void Import(object[] records)
{
Log.Information("Processing completed {@recordCount}", records.Count);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment