To which 开发者_高级运维layer does the logger belongs in DDD?
What would we want to log in DDD?
Important events that occur, of course.
The Logger itself is a service of the infrastructure. Bridging the domain and the logger can occur in an event handler.
Logging fits well inside of event handlers and when placed there it creates a very nice separation of concerns.
I'm not sure what your requirements for a logger are, but if you are using it for creating an audit trail to track changes to an aggregate then it should go into the repository layer.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论