File tree Expand file tree Collapse file tree
handwritten/logging-winston Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,10 +47,10 @@ export async function makeMiddleware(
4747 const options = { logName : 'winston_log' , ...optionsOrTransport } ;
4848
4949 transport = new LoggingWinston ( options ) ;
50- logger . add ( transport ) ;
5150 } else {
5251 transport = optionsOrTransport ;
5352 }
53+ logger . add ( transport ) ;
5454
5555 const auth = transport . common . stackdriverLog . logging . auth ;
5656 const [ env , projectId ] = await Promise . all ( [
Original file line number Diff line number Diff line change @@ -113,6 +113,13 @@ describe('middleware/express', () => {
113113 assert . strictEqual ( logger . transports [ 0 ] , transport ) ;
114114 } ) ;
115115
116+ it ( 'should add a user provided transport to the logger' , async ( ) => {
117+ const t = new FakeLoggingWinston ( { } ) ;
118+ await makeMiddleware ( logger , t ) ;
119+ assert . strictEqual ( logger . transports . length , 1 ) ;
120+ assert . strictEqual ( logger . transports [ 0 ] , t ) ;
121+ } ) ;
122+
116123 it ( 'should create a transport with the correct logName' , async ( ) => {
117124 await makeMiddleware ( logger ) ;
118125 assert . ok ( passedOptions ) ;
You can’t perform that action at this time.
0 commit comments