Update cipher logging
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user