Hi and thank you for wonderful library. I have a Logger class which logs startup of app and some other things. Inside scoped container (per request) I generate TraceId and currently I need to have two loggers. One that accepts TraceId and one that does not, otherwise all the same.
I tried registering Logger in main container with injected traceId (value "app") but then when tried to overwrite the Logger in scoped container it still returns the main instance and not the one with proper traceId.
Can we have some enhancement, that when we instantiate from a scoped container that we first search it and then main container? Or that dispose cache removes only one registration? And one suggestion for addition is that we can have .optional() when registering object which in my case will put the traceId as undefined when resolved.
EDIT: I have figured out a solution. Use one Logger class with traceId injected in main container and in scope container register it under different name.
Hi and thank you for wonderful library. I have a Logger class which logs startup of app and some other things. Inside scoped container (per request) I generate TraceId and currently I need to have two loggers. One that accepts TraceId and one that does not, otherwise all the same.
I tried registering Logger in main container with injected traceId (value "app") but then when tried to overwrite the Logger in scoped container it still returns the main instance and not the one with proper traceId.
Can we have some enhancement, that when we instantiate from a scoped container that we first search it and then main container? Or that dispose cache removes only one registration? And one suggestion for addition is that we can have .optional() when registering object which in my case will put the traceId as undefined when resolved.
EDIT: I have figured out a solution. Use one Logger class with traceId injected in main container and in scope container register it under different name.