mardi 22 novembre 2016

java conditional logging with decorator pattern

I have a use case where I need to do conditional loggging, so what that means is lets say I have method bark() which would accept Animal and if I pass dog it should log something like The dog is barking. So based on the type of object the log statement would change. One thing that can be done is check the type of object and based on that do the logging but that might not be a very efficient way of doing. So in any way would this use case be solved with decorator pattern or is there a better way of solving this.

Aucun commentaire:

Enregistrer un commentaire