开发者

Where does a logger goes 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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜