From 222de9a3e8ef7f1a8af68cc179bd87ba637d2865 Mon Sep 17 00:00:00 2001 From: ghadyg Date: Wed, 25 Sep 2024 22:30:05 +0300 Subject: [PATCH] Refactor logging statements to eliminate string concatenation --- .../java/com/josdem/vetlog/controller/AdoptionController.java | 4 ++-- .../java/com/josdem/vetlog/controller/BreedController.java | 2 +- .../java/com/josdem/vetlog/controller/PetLogController.java | 4 ++-- .../com/josdem/vetlog/controller/TelephoneController.java | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/josdem/vetlog/controller/AdoptionController.java b/src/main/java/com/josdem/vetlog/controller/AdoptionController.java index 87c936f7..c6e12d17 100644 --- a/src/main/java/com/josdem/vetlog/controller/AdoptionController.java +++ b/src/main/java/com/josdem/vetlog/controller/AdoptionController.java @@ -59,14 +59,14 @@ private void initBinder(WebDataBinder binder) { @GetMapping(value = "/descriptionForAdoption") public ModelAndView descriptionForAdoption(AdoptionCommand adoptionCommand) { - log.info("Adding description to pet with uuid: " + adoptionCommand.getUuid()); + log.info("Adding description to pet with uuid: {}", adoptionCommand.getUuid()); ModelAndView modelAndView = new ModelAndView(); return fillPetAndAdoptionCommand(modelAndView, adoptionCommand); } @PostMapping(value = "/save") public ModelAndView save(@Valid AdoptionCommand adoptionCommand, BindingResult bindingResult) { - log.info("Creating adoption description for pet: " + adoptionCommand.getUuid()); + log.info("Creating adoption description for pet: {}", adoptionCommand.getUuid()); if (bindingResult.hasErrors()) { ModelAndView modelAndView = new ModelAndView("adoption/descriptionForAdoption"); fillPetAndAdoptionCommand(modelAndView, adoptionCommand); diff --git a/src/main/java/com/josdem/vetlog/controller/BreedController.java b/src/main/java/com/josdem/vetlog/controller/BreedController.java index 4335386e..d67e4b52 100644 --- a/src/main/java/com/josdem/vetlog/controller/BreedController.java +++ b/src/main/java/com/josdem/vetlog/controller/BreedController.java @@ -40,7 +40,7 @@ public class BreedController { @GetMapping(value = "/list") @ResponseBody public List listByType(@RequestParam String type, HttpServletResponse response) { - log.info("Listing Pets by type: " + type); + log.info("Listing Pets by type: {}", type); response.addHeader("Allow-Control-Allow-Methods", "GET"); response.addHeader("Access-Control-Allow-Origin", "*"); diff --git a/src/main/java/com/josdem/vetlog/controller/PetLogController.java b/src/main/java/com/josdem/vetlog/controller/PetLogController.java index c92df426..6b9294fe 100644 --- a/src/main/java/com/josdem/vetlog/controller/PetLogController.java +++ b/src/main/java/com/josdem/vetlog/controller/PetLogController.java @@ -61,7 +61,7 @@ public class PetLogController { @GetMapping(value = "/create") public ModelAndView create(@RequestParam("uuid") String uuid, HttpServletRequest request) { - log.info("Pet uuid: " + uuid); + log.info("Pet uuid: {}", uuid); ModelAndView modelAndView = new ModelAndView("petlog/create"); Command petLogCommand = new PetLogCommand(); modelAndView.addObject(PET_LOG_COMMAND, petLogCommand); @@ -75,7 +75,7 @@ public ModelAndView create(@RequestParam("uuid") String uuid, HttpServletRequest public ModelAndView save( @Valid PetLogCommand petLogCommand, BindingResult bindingResult, HttpServletRequest request) throws IOException { - log.info("Creating petLog: " + petLogCommand.getPet()); + log.info("Creating petLog: {}", petLogCommand.getPet()); ModelAndView modelAndView = new ModelAndView("petlog/create"); Pet pet = petService.getPetById(petLogCommand.getPet()); User currentUser = userService.getCurrentUser(); diff --git a/src/main/java/com/josdem/vetlog/controller/TelephoneController.java b/src/main/java/com/josdem/vetlog/controller/TelephoneController.java index 25575c9c..518f1734 100644 --- a/src/main/java/com/josdem/vetlog/controller/TelephoneController.java +++ b/src/main/java/com/josdem/vetlog/controller/TelephoneController.java @@ -55,7 +55,7 @@ public class TelephoneController { @PostMapping(value = "/save") public ModelAndView save( @Valid TelephoneCommand telephoneCommand, BindingResult bindingResult, HttpServletRequest request) { - log.info("Saving adoption for pet: " + telephoneCommand.getUuid()); + log.info("Saving adoption for pet: {}", telephoneCommand.getUuid()); if (bindingResult.hasErrors()) { ModelAndView modelAndView = new ModelAndView("telephone/adopt"); return fillPetAndTelephoneCommand(modelAndView, telephoneCommand); @@ -69,7 +69,7 @@ public ModelAndView save( @GetMapping(value = "/adopt") public ModelAndView adopt(TelephoneCommand telephoneCommand) { - log.info("Adoption to pet with uuid: " + telephoneCommand.getUuid()); + log.info("Adoption to pet with uuid: {}", telephoneCommand.getUuid()); ModelAndView modelAndView = new ModelAndView("telephone/adopt"); return fillPetAndTelephoneCommand(modelAndView, telephoneCommand); }