开发者

Where does a logger goes in DDD?

开发者 https://www.devze.com 2023-02-05 04:11 出处:网络
To which 开发者_高级运维layer does the logger belongs in DDD?What would we want to log in DDD?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消