Where is the log written to the model controller architecture?

I would like to record communication activity and, as part of logging, display the message history in a window on the screen. I don’t want the communication modules to know about the screen, of course, but any method can write to the log. Then the logging module routes information (screen, file). Is the magazine considered part of the model?

+4
source share
1 answer

Whether the commands executed by the instance are written or not should not affect the instance itself. This means that if, for example, you want to perform the registration performed by the controller, the controller itself should not keep a log or in any other way know that it is being registered.

It is best to have a copy decorated . The decorator will need the original instance and the constructor of thinkers embedded in the magazine.

Assuming your MVC components (views, controllers, and structures from the mode level) are already created using the factory, this will be the best "level" at which you switch between logged and unrecorded mode.

TL DR

No. Logging is not part of the MVC triad itself.

+2
source

Source: https://habr.com/ru/post/1486254/


All Articles