-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Debut de réécriture sdu système de logs
- Loading branch information
jvk
committed
Apr 10, 2024
1 parent
aa9267e
commit 37247ae
Showing
4 changed files
with
80 additions
and
17 deletions.
There are no files selected for viewing
12 changes: 0 additions & 12 deletions
12
batch/src/main/java/fr/abes/item/logging/DemandeLogger.java
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
batch/src/main/java/fr/abes/item/service/logging/DemandeLoggerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package fr.abes.item.service.logging; | ||
|
||
import fr.abes.item.entities.item.Demande; | ||
import fr.abes.item.entities.item.LigneFichier; | ||
import lombok.Data; | ||
import lombok.experimental.Accessors; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
@Service | ||
@Data | ||
@Accessors(chain = true) | ||
public class DemandeLoggerService { | ||
private Demande demande; | ||
private LigneFichier ligneFichier; | ||
private List<Long> heureEvenements; | ||
private String objetDeTraitementEnCours = ""; | ||
private String exception = ""; | ||
StringBuilder sb = new StringBuilder(); | ||
|
||
public String logInfo(){ | ||
|
||
sb.append("DEMANDE:"); | ||
if(demande != null){ | ||
sb.append(demande.getNumDemande()); | ||
}else{ | ||
sb.append("NULL"); | ||
} | ||
sb.append("|"); | ||
|
||
if(!objetDeTraitementEnCours.isEmpty()){ | ||
sb.append("TACHE:"); | ||
sb.append(this.objetDeTraitementEnCours); | ||
sb.append("|"); | ||
} | ||
|
||
if(!objetDeTraitementEnCours.isEmpty()){ | ||
sb.append("EXCEPTION:"); | ||
sb.append(this.exception); | ||
sb.append("|"); | ||
} | ||
|
||
|
||
return sb.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
batch/src/test/java/fr/abes/item/service/logging/DemandeLoggerServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package fr.abes.item.service.logging; | ||
|
||
import fr.abes.item.entities.item.Demande; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class DemandeLoggerServiceTest { | ||
|
||
private Demande demande; | ||
@Test | ||
void testLombokAccessors(){ | ||
DemandeLoggerService demandeLoggerService = new DemandeLoggerService(); | ||
//log.info(demandeLoggerService.setObjetDeTraitementEnCours("Obtention de la demande à traiter").setDemande(this.demande).logInfo()); | ||
} | ||
} |