feat(common): add API operation logging with AOP and trace ID tracking
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package com.hanserwei.common.utils;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class JsonUtils {
|
||||
private static final ObjectMapper INSTANCE = new ObjectMapper();
|
||||
|
||||
public static String toJsonString(Object obj) {
|
||||
try {
|
||||
return INSTANCE.writeValueAsString(obj);
|
||||
} catch (JsonProcessingException e) {
|
||||
return obj.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user