Closed guillaume-chevalier closed 2 years ago
I agree with this except the part where we use keys to access services which are there by default. I'd rather have these services as attribute of the context since they are not optional anyway.
class Logger
in Neuraxle could be useful. For instance: Logger.get_default_logger()
, or Logger.from_raw_logger(logger)
BaseLogger and a DefaultConsoleLogger
context.get_service("logger")
Is your feature request related to a problem? Please describe. Problems:
Describe the solution you'd like
Note that upon failing an assertion, the Asserter would need to get the logger in the context to log the failure as well. This means that despite the Asserter is in the Context, the Asserter needs to be passed the context when asserting so as to be able to fetch the Logger of the context. This means that the Logger is probably a service with a predefined service Key string (e.g.: context.get_service("logger").
Overall, the context seems to need some basic services at all times, and for ensuring consistency of the code and proper interdependency of the services, some services seem to require some predefined keys. I do not have ideas of alternatives for this idea, and I would like to find a better solution than to use predefined reserved keys.
FYI @vincent-antaki