Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
rmccabe55 committed Jul 20, 2020
1 parent 268d00e commit 4d4c363
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,18 @@ ITelemeteryLogger logger = new AppInsightsLogger("instrumentationKey");
// Log metrics.
logger.LogMetric("Metric Name", 100);

// Log custom dimensions.
// Log custom dimensions (as dictionary).
logger.LogInformation("Some log message", new Dictionary<string, string> {
{ "dimension1", "someVal" },
{ "dimension2", "someOtherVal" }
});

// Log custom dimensions (as object).
logger.LogInformation("Some log message", new Example { Property1 = "someval", Property2 = true });
```

_NOTE: Fields that have been marked as `Cloud.Core.Attributes.PersonalData`, `Cloud.Core.Attributes.SensitiveInfo` or `Microsoft.AspNetCore.Identity.PersonalData` are masked automatically when writing custom dimensions. The log message itself and the dicntionary are not checked for personal information - masking can only be used when logging a model (as then the properties can be reflected and inspected for the appropriate attributes)._

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_
Expand Down

0 comments on commit 4d4c363

Please sign in to comment.