diff --git a/README.md b/README.md index e3bfed1..e5400c2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -# **Cloud.Core.Telemetry.AzureAppInsights** [![Build status](https://dev.azure.com/cloudcoreproject/CloudCore/_apis/build/status/Cloud.Core/Cloud.Core.Telemetry.AzureAppInsights_Package)](https://dev.azure.com/cloudcoreproject/CloudCore/_build/latest?definitionId=10) ![Code Coverage](https://cloud1core.blob.core.windows.net/codecoveragebadges/Cloud.Core.Telemetry.AzureAppInsights-LineCoverage.png) -[![Cloud.Core.Configuration package in Cloud.Core feed in Azure Artifacts](https://feeds.dev.azure.com/cloudcoreproject/dfc5e3d0-a562-46fe-8070-7901ac8e64a0/_apis/public/Packaging/Feeds/8949198b-5c74-42af-9d30-e8c462acada6/Packages/e71ddf20-f66a-45da-b672-c32798cf1e51/Badge)](https://dev.azure.com/cloudcoreproject/CloudCore/_packaging?_a=package&feed=8949198b-5c74-42af-9d30-e8c462acada6&package=e71ddf20-f66a-45da-b672-c32798cf1e51&preferRelease=true) +# **Cloud.Core.Telemetry.AzureAppInsights** [![Build status](https://dev.azure.com/cloudcoreproject/CloudCore/_apis/build/status/Cloud.Core/Cloud.Core.Telemetry.AzureAppInsights_Package)](https://dev.azure.com/cloudcoreproject/CloudCore/_build/latest?definitionId=10) ![Code Coverage](https://cloud1core.blob.core.windows.net/codecoveragebadges/Cloud.Core.Telemetry.AzureAppInsights-LineCoverage.png) [![Cloud.Core.Telemetry.AzureAppInsights package in Cloud.Core feed in Azure Artifacts](https://feeds.dev.azure.com/cloudcoreproject/dfc5e3d0-a562-46fe-8070-7901ac8e64a0/_apis/public/Packaging/Feeds/8949198b-5c74-42af-9d30-e8c462acada6/Packages/77080b8d-f547-4193-b2a1-6cdfd7eb6719/Badge)](https://dev.azure.com/cloudcoreproject/CloudCore/_packaging?_a=package&feed=8949198b-5c74-42af-9d30-e8c462acada6&package=77080b8d-f547-4193-b2a1-6cdfd7eb6719&preferRelease=true) @@ -71,6 +70,21 @@ public class Startup } ``` +## Logging Metrics and Custom Dimensions + +```csharp +ITelemeteryLogger logger = new AppInsightsLogger("instrumentationKey"); + +// Log metrics. +logger.LogMetric("Metric Name", 100); + +// Log custom dimensions. +logger.LogInformation("Some log message", new Dictionary { + { "dimension1", "someVal" }, + { "dimension2", "someOtherVal" } +}); +``` + If you use the first example (implicitly AddingAppInsightsLogger) without specifying config, the code will look for the instrumentation key in one of the following config settings: 1. _InstrumentationKey_