I have two classes in my project that I would like to pass a logger from the main class to a subclass and have a subclass for using the parameters of the parent registrar.
A subclass is a separate general class (i.e. not tied to the main class) and should be able to create its own journal if it is not provided.
The main class creates a logger, adds a console handler, a file handler and a log formatter, and I would like the subclass to temporarily override the log formatter for log messages, and then when the main class resumes, return the log formatter to it.
I tried to bring the logger to a subclass or create a new one if necessary, but I get a few messages on the screen and in the log file (it seems this is adding handlers to the main class, than overloading it).
How should I do it?
source
share