import ApplicationInsights = require ( "applicationinsights" ) ; import { channel , IStandardEvent } from "diagnostic-channel" ; import { console as consolePub } from "diagnostic-channel-publishers" ; export const subscriber = ( event ) => { if ( ApplicationInsights . defaultClient ) { const severity = event . data . stderr ? ApplicationInsights . Contracts . SeverityLevel . Warning : ApplicationInsights . Contracts . SeverityLevel . Information ; ApplicationInsights . defaultClient . trackTrace ( { message : event . data . message , severity : severity } ) ; } } ; channel . subscribe < consolePub . IConsoleData > ( "console" , subscriber ) ;