winston-appinsights-transport
Advanced tools
Comparing version 0.1.6 to 0.1.7
# ApplicationInsights Winstron Transport | ||
## 0.1.7 | ||
- fix for request logging | ||
## 0.1.6 | ||
@@ -4,0 +7,0 @@ - expose request log api |
import * as TransportStream from 'winston-transport'; | ||
import * as ai from 'applicationinsights'; | ||
export interface AppInsightsCustomFields { | ||
[key: string]: string; | ||
[key: string]: any; | ||
} | ||
@@ -32,3 +32,2 @@ export interface AppInsightsOptions { | ||
log({message, level, ...properties}: TransportStream.TransportLogInfo, callback: Function): any; | ||
request(req: AppInsightsRequest, properties: AppInsightsCustomFields): void; | ||
} |
@@ -75,14 +75,25 @@ "use strict"; | ||
} | ||
this.client.trackTrace({ | ||
message: message, | ||
severity: exports.getApplicationInsightsSeverity(level), | ||
properties: Object.assign({}, properties, this.customFields), | ||
}); | ||
if (properties.url) { | ||
const { name, url, duration, resultCode, success, source } = properties, customFields = __rest(properties, ["name", "url", "duration", "resultCode", "success", "source"]); | ||
this.client.trackRequest({ | ||
name: properties.name, | ||
url: properties.url, | ||
duration: parseInt(properties.duration, 10), | ||
resultCode: properties.resultCode, | ||
success: !!properties.success, | ||
source: properties.source, | ||
properties: Object.assign({}, customFields, this.customFields), | ||
}); | ||
} | ||
else { | ||
this.client.trackTrace({ | ||
message: message, | ||
severity: exports.getApplicationInsightsSeverity(level), | ||
properties: Object.assign({}, properties, this.customFields), | ||
}); | ||
} | ||
return callback(null); | ||
} | ||
request(req, properties) { | ||
this.client.trackRequest(Object.assign({}, req, { properties: Object.assign({}, properties, this.customFields) })); | ||
} | ||
} | ||
exports.AppInsightsTransport = AppInsightsTransport; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "winston-appinsights-transport", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "A winston transport for Application Insights", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10818
132