inversify-tracer icon indicating copy to clipboard operation
inversify-tracer copied to clipboard

Tracer instantiation affects the mongoose model binging in a singleton

Open patb23 opened this issue 4 years ago • 0 comments

My apologies for not providing a title that defines the problem correctly. Have raised an issue in inversify explaining the problem. I identified the lines of code, causing the problem. Pasting the relevant code here. If I get the repository from the container before these lines, the repo has reference to the mongoose model but after these, the model becomes 'anonymous'. The repo is singleton. I can provide more details, if the issue is not clear. Could you please let me know why am I noticing this behavior?

        const tracer = new InversifyTracer({filters: ["*:*", "!Mongo*", "!EventEmitter"],});

        tracer.on('call', (callInfo: CallInfo) => {
            console.log(`${callInfo.className} ${callInfo.methodName} `);
        });

        tracer.on('return', (returnInfo: ReturnInfo) => {
            console.log(`${returnInfo.className} ${returnInfo.methodName} returned ${returnInfo.result} - ${returnInfo.executionTime}ms`);
        });

        tracer.apply(container);

patb23 avatar Aug 06 '20 05:08 patb23