Skip to content

Commit

Permalink
Merge pull request #226 from ASAP-as-soon-as-possible/feat/#225
Browse files Browse the repository at this point in the history
#225 [fix] 가독성을 위한 로그 포맷 수정
  • Loading branch information
KWY0218 authored Oct 10, 2023
2 parents 566821b + c913efb commit 7f3519a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ public Object requestLogging(ProceedingJoinPoint proceedingJoinPoint) throws Thr
long startAt = System.currentTimeMillis();
Object returnValue = proceedingJoinPoint.proceed(proceedingJoinPoint.getArgs());
long endAt = System.currentTimeMillis();
log.info("====> Request: {} {} ({}ms)\n *Header = {}\n", request.getMethod(), request.getRequestURL(), endAt - startAt, getHeaders(request));
log.info("================================================NEW===============================================");
log.info("====> Request: {} {} ({}ms)\n *Header = {}", request.getMethod(), request.getRequestURL(), endAt - startAt, getHeaders(request));
if ("POST".equalsIgnoreCase(request.getMethod())) {
log.info("====> Body: {}", objectMapper.readTree(cachingRequest.getContentAsByteArray()));
}
if (returnValue != null) {
log.info("====> Response: {}\n", returnValue);
log.info("====> Response: {}", returnValue);
}
log.info("================================================END===============================================");
return returnValue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
public class ErrorDataResponse<T> extends ErrorResponse {

private T data;

private ErrorDataResponse(int code, String message, T data) {
super(code, message);
this.data = data;
Expand All @@ -15,4 +16,9 @@ private ErrorDataResponse(int code, String message, T data) {
public static <T> ErrorDataResponse<T> error(Error error, String message, T data) {
return new ErrorDataResponse<T>(error.getHttpStatusCode(), message, data);
}

@Override
public String toString() {
return "code: " + super.getCode() + " message: " + super.getMessage() + " data: " + this.data;
}
}

0 comments on commit 7f3519a

Please sign in to comment.