Skip to content

Commit

Permalink
Updated current.info.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis J. McWherter Jr committed Oct 17, 2016
1 parent f2ef4ac commit 4e146bd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ public void add(LogInfo phase) {
body.put(phase.getName(), phase);
}

/**
* Create a new LogBlock with the same body but updated uuid.
*
* @param uuid New uuid.
* @return New LogBlock with updated uuid.
*/
public LogBlock withUuid(String uuid) {
LogBlock newLogBlock = new LogBlock(uuid);
body.entrySet().forEach(entry -> newLogBlock.body.put(entry.getKey(), entry.getValue()));
return newLogBlock;
}

/**
* Add an entry of given class in this LogBlock that holds no information.
* It is meant to be used only to define the order of {@link LogInfo} parts inside a LogBlock.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ public static String getId() {
public static void addIdPrefix(String idPrefix) {
RequestLog current = RLOG.get();
String newId = idPrefix + getId();
current.info = current.info.withUuid(newId);
current.logId = newId;
MDC.put(ID_KEY, newId);
}
Expand Down

0 comments on commit 4e146bd

Please sign in to comment.