winston-appinsights-transport
Advanced tools
Comparing version 0.1.1 to 0.1.2
# ApplicationInsights Winstron Transport | ||
## 0.1.2 | ||
- added type declaration file for winston-transport | ||
## 0.1.1 | ||
@@ -4,0 +7,0 @@ |
@@ -1,2 +0,2 @@ | ||
import * as Transport from 'winston-transport'; | ||
import * as TransportStream from 'winston-transport'; | ||
import * as ai from 'applicationinsights'; | ||
@@ -10,10 +10,2 @@ export interface AppInsightsCustomFields { | ||
} | ||
export interface TransportLogInfo { | ||
message: string; | ||
level: string; | ||
[key: string]: string; | ||
} | ||
export interface TransportLog { | ||
(info: TransportLogInfo, callback: Function): void; | ||
} | ||
export declare enum Levels { | ||
@@ -27,8 +19,8 @@ fatal = 0, | ||
export declare const getApplicationInsightsSeverity: (level: string) => ai.Contracts.SeverityLevel; | ||
export declare class AppInsightsTransport extends Transport { | ||
client: ai.TelemetryClient; | ||
customFields: AppInsightsCustomFields; | ||
constructor(opts: any); | ||
handleUnhandledErrors(): void; | ||
log({message, level, ...properties}: TransportLogInfo, callback: Function): void; | ||
export declare class AppInsightsTransport extends TransportStream { | ||
private client; | ||
private customFields; | ||
constructor({instrumentationKey, customFields, ...options}: AppInsightsOptions & TransportStream.TransportOptions); | ||
private handleUnhandledErrors(); | ||
log({message, level, ...properties}: TransportStream.TransportLogInfo, callback: Function): any; | ||
} |
@@ -12,3 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const Transport = require("winston-transport"); | ||
const TransportStream = require("winston-transport"); | ||
const ai = require("applicationinsights"); | ||
@@ -39,12 +39,9 @@ var Levels; | ||
}; | ||
class AppInsightsTransport extends Transport { | ||
constructor(opts) { | ||
// TODO: | ||
// Either provide a real module definition for winston-transport (preferred) or create an issue with | ||
// the library maintainer: https://github.com/winstonjs/winston-transport | ||
// @ts-ignore | ||
super(opts); | ||
class AppInsightsTransport extends TransportStream { | ||
constructor(_a) { | ||
var { instrumentationKey, customFields } = _a, options = __rest(_a, ["instrumentationKey", "customFields"]); | ||
super(options); | ||
// We disabled auto collecting exceptions and requests because we need to inject the request id manually | ||
ai | ||
.setup(opts.instrumentationKey) | ||
.setup(instrumentationKey) | ||
.setAutoCollectConsole(false) | ||
@@ -55,3 +52,3 @@ .setAutoCollectExceptions(false) | ||
this.client = ai.defaultClient; | ||
this.customFields = opts.customFields; | ||
this.customFields = customFields; | ||
this.handleUnhandledErrors(); | ||
@@ -85,3 +82,3 @@ } | ||
}); | ||
callback(); | ||
return callback(null); | ||
} | ||
@@ -88,0 +85,0 @@ } |
{ | ||
"name": "winston-appinsights-transport", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"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
9050
109