@@ -4,6 +4,7 @@ import sinon from "sinon";
44import { AppServicesLoader } from "../../../src/agent/appServicesLoader" ;
55import { DiagnosticLogger } from "../../../src/agent/diagnostics/diagnosticLogger" ;
66import { FileWriter } from "../../../src/agent/diagnostics/writers/fileWriter" ;
7+ import { InstrumentationOptions } from "../../../src/types" ;
78import {
89 SEMRESATTRS_SERVICE_INSTANCE_ID ,
910 SEMRESATTRS_SERVICE_NAME ,
@@ -98,4 +99,23 @@ describe("agent/AppServicesLoader", () => {
9899 "testRole"
99100 ) ;
100101 } ) ;
102+
103+ it ( "should enable console, bunyan, and winston logging instrumentations" , ( ) => {
104+ const env = {
105+ [ "APPLICATIONINSIGHTS_CONNECTION_STRING" ] : "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333" ,
106+ [ "HOME" ] : "c:" ,
107+ } ;
108+ process . env = env ;
109+ const agent = new AppServicesLoader ( ) ;
110+
111+ // Verify that logging instrumentations are enabled
112+ const instrumentationOptions = agent [ "_options" ] . instrumentationOptions as InstrumentationOptions ;
113+ assert . ok ( instrumentationOptions , "instrumentationOptions should be present" ) ;
114+ assert . ok ( instrumentationOptions . console , "console instrumentation should be present" ) ;
115+ assert . equal ( instrumentationOptions . console . enabled , true , "console instrumentation should be enabled" ) ;
116+ assert . ok ( instrumentationOptions . bunyan , "bunyan instrumentation should be present" ) ;
117+ assert . equal ( instrumentationOptions . bunyan . enabled , true , "bunyan instrumentation should be enabled" ) ;
118+ assert . ok ( instrumentationOptions . winston , "winston instrumentation should be present" ) ;
119+ assert . equal ( instrumentationOptions . winston . enabled , true , "winston instrumentation should be enabled" ) ;
120+ } ) ;
101121} ) ;
0 commit comments