Skip to content

Commit 8f2fd42

Browse files
committed
Breaking out add/modify to a new article
1 parent 6c4526b commit 8f2fd42

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

articles/azure-monitor/app/opentelemetry-add-modify.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,46 +1161,46 @@ Not available in .NET.
11611161

11621162
First, get the `LogHandler`:
11631163

1164-
```javascript
1165-
const { ApplicationInsightsClient, ApplicationInsightsConfig } = require("applicationinsights");
1166-
const appInsights = new ApplicationInsightsClient(new ApplicationInsightsConfig());
1167-
const logHandler = appInsights.getLogHandler();
1168-
```
1164+
```javascript
1165+
const { ApplicationInsightsClient, ApplicationInsightsConfig } = require("applicationinsights");
1166+
const appInsights = new ApplicationInsightsClient(new ApplicationInsightsConfig());
1167+
const logHandler = appInsights.getLogHandler();
1168+
```
11691169

11701170
Then use the `LogHandler` to send custom telemetry:
11711171

1172-
##### Events
1173-
1174-
```javascript
1175-
let eventTelemetry = {
1176-
name: "testEvent"
1177-
};
1178-
logHandler.trackEvent(eventTelemetry);
1179-
```
1180-
1181-
##### Logs
1172+
##### Events
1173+
1174+
```javascript
1175+
let eventTelemetry = {
1176+
name: "testEvent"
1177+
};
1178+
logHandler.trackEvent(eventTelemetry);
1179+
```
1180+
1181+
##### Logs
1182+
1183+
```javascript
1184+
let traceTelemetry = {
1185+
message: "testMessage",
1186+
severity: "Information"
1187+
};
1188+
logHandler.trackTrace(traceTelemetry);
1189+
```
11821190

1183-
```javascript
1184-
let traceTelemetry = {
1185-
message: "testMessage",
1186-
severity: "Information"
1191+
##### Exceptions
1192+
1193+
```javascript
1194+
try {
1195+
...
1196+
} catch (error) {
1197+
let exceptionTelemetry = {
1198+
exception: error,
1199+
severity: "Critical"
11871200
};
1188-
logHandler.trackTrace(traceTelemetry);
1189-
```
1190-
1191-
##### Exceptions
1192-
1193-
```javascript
1194-
try {
1195-
...
1196-
} catch (error) {
1197-
let exceptionTelemetry = {
1198-
exception: error,
1199-
severity: "Critical"
1200-
};
1201-
logHandler.trackException(exceptionTelemetry);
1202-
}
1203-
```
1201+
logHandler.trackException(exceptionTelemetry);
1202+
}
1203+
```
12041204

12051205
#### [Python](#tab/python)
12061206

0 commit comments

Comments
 (0)