You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.3 KiB
Java
41 lines
1.3 KiB
Java
package at.procon.ted.service;
|
|
|
|
import at.procon.ted.model.entity.ProcurementDocument;
|
|
import at.procon.ted.model.entity.ProcessingLog;
|
|
import at.procon.ted.repository.ProcessingLogRepository;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
/**
|
|
* Service for logging processing events.
|
|
*
|
|
* @author Martin.Schweitzer@procon.co.at and claude.ai
|
|
*/
|
|
@Service
|
|
@RequiredArgsConstructor
|
|
@Slf4j
|
|
public class ProcessingLogService {
|
|
|
|
private final ProcessingLogRepository logRepository;
|
|
|
|
@Transactional
|
|
public void logEvent(ProcurementDocument document, String documentHash, String eventType,
|
|
String eventStatus, String message, String errorDetails,
|
|
String sourceFilename, Integer durationMs) {
|
|
ProcessingLog logEntry = ProcessingLog.builder()
|
|
.document(document)
|
|
.documentHash(documentHash)
|
|
.eventType(eventType)
|
|
.eventStatus(eventStatus)
|
|
.message(message)
|
|
.errorDetails(errorDetails)
|
|
.sourceFilename(sourceFilename)
|
|
.durationMs(durationMs)
|
|
.build();
|
|
|
|
logRepository.save(logEntry);
|
|
}
|
|
}
|