Update cipher logging

This commit is contained in:
2024-04-28 15:26:40 -04:00
parent 1183cab5f1
commit cc0aa2986d
26 changed files with 94 additions and 45 deletions

View File

@@ -4,6 +4,7 @@ package com.mattrixwv.cipherstream.aspect;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.MDC;
import org.springframework.context.annotation.Configuration;
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -35,7 +36,17 @@ public class CipherStreamLoggingAspect{
@AfterReturning(pointcut = "cipherMethod() && postFunction()", returning = "returnedJson")
public void getCipherInfo(ObjectNode returnedJson){
//Extract JSON to MDC
returnedJson.fields().forEachRemaining(entry -> {
if(entry.getValue().isTextual()){
MDC.put(entry.getKey(), entry.getValue().asText());
}
else{
MDC.put(entry.getKey(), entry.getValue().toString());
}
});
//Print a log
log.info("CipherStream log {}", returnedJson);
log.info("CipherStream log");
}
}