I have one application with four layers for a specific functional requirement.
UI Layer -> Presentation Logic Layer -> Business Logic Layer -> Persistent Layer
One minimal working example for call flow can be like,
class ProductViewController {
func showProduct(list){
// populate list in view
}
}
class ProductPresenter {
func sanitiseProduct(list){
// apply presentation logic to list
viewController.showProduct(list)
}
}
class ProductService {
func filerProducts(list){
// apply filtering logic to list
productPresenter.sanitiseProduct(list)
}
}
class ProductDatabase {
func retrieveProducts(){
// retrieve raw product list
productService.filerProducts(getAllProduct())
}
}
Now if any exception (i.e. query exception in Database layer) happens in any layer of the flow I have decided to log and throw it in all layers above with appropriate TAG and info so that while debugging, any layer can filter their own logs using appropriate TAG without looking into other layers (i.e. when different teams are made for different layers).
While reviewing, one of my colleagues commented that in my design, there will be duplication of logs for a single exception which might cost performance and memory. His suggestion is to apply logging in one of the layers for specific exceptions (i.e. query exception in Persistent Layer only). Although he suggested to throw the exception to upper layers.
Is my logging approach which provides better maintainability should be changed for the sake of performance and memory? What are the general suggestions to deal with this situation?
Aucun commentaire:
Enregistrer un commentaire