Skip to content

Commit

Permalink
Expose RequestLog's LogInfo objects.
Browse files Browse the repository at this point in the history
-- Some customers want to be able to customize how the RequestLog is
logged. By exposing the LogInfo objects and the durations, we
effectively give customers full control over how they want to log
each component of the RequestLog.
  • Loading branch information
Andrew Cholewa committed Nov 14, 2017
1 parent 1aee993 commit 921963c
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,21 @@ public static LogInfo retrieve(Class cls) {
return logInfo;
}

/**
* Returns a map of all the LogInfo blocks currently registered with this thread's RequestLog.
*
* @return A map of all the LogInfo objects registered to this thread's RequestLog
*/
public static Map<String, LogInfo> retrieveAll() {
RequestLog requestLog = RLOG.get();
if (requestLog == null) {
String message = String.format("Attempted to retrieve log info while request log object was uninitialized");
LOG.error(message);
throw new IllegalStateException(message);
}
return requestLog.info.any();
}

/**
* Write the request log object of the current thread as JSON.
* The thread's request log is cleared after a call to this method.
Expand Down

0 comments on commit 921963c

Please sign in to comment.