/** * A utility method for closing calls to the anonymous startTrack() call. */ public static void endTrack(){ endTrack(""); }
public static void endTrack(){ Redwood.endTrack(); } public static void endTrackIfOpen(String check) {
public static void endTrack(String check){ Redwood.endTrack(check); } public static void endTrack(){ Redwood.endTrack(); }
public static void endTrackIfOpen(String check) { if (!Redwood.titleStack.empty() && Redwood.titleStack.peek().equals(check)) { Redwood.endTrack(check); } } public static void endTracksUntil(String check) {
public static void endTracksUntil(String check) { while (!Redwood.titleStack.empty() && !Redwood.titleStack.peek().equals(check)) { Redwood.endTrack(Redwood.titleStack.peek()); } } public static void endTracksTo(String check) { endTracksUntil(check); endTrack(check); }
endTrack("Threads( "+check+" )");
/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public void prettyLog(RedwoodChannels channels, String description) { Redwood.startTrack(description); // sort keys by class name List<Class> sortedKeys = new ArrayList<>(this.keySet()); sortedKeys.sort(Comparator.comparing(Class::getCanonicalName)); // log key/value pairs for (Class key : sortedKeys) { String keyName = key.getCanonicalName().replace("class ", ""); Object value = this.get(key); if (PrettyLogger.dispatchable(value)) { PrettyLogger.log(channels, keyName, value); } else { channels.logf("%s = %s", keyName, value); } } Redwood.endTrack(description); }
private static <T> void log(RedwoodChannels channels, String description, T[] array) { Redwood.startTrack(description); if (array == null) { channels.log("(array is null)"); } else if (array.length == 0) { channels.log("(empty)"); } else { int index = 0; for (T item : array) { if (dispatchable(item)) { log(channels, "Index " + index, item); } else { channels.logf("Index %d: %s", index, item); } index++; } } Redwood.endTrack(description); }
log("message " + fI + ".5"); forceTrack("Runnable " + fI + ".1"); endTrack("Runnable " + fI + ".1"); forceTrack("Runnable " + fI + ".2"); log("a message"); endTrack("Runnable " + fI + ".2"); forceTrack("Runnable " + fI + ".3"); log("a message"); log(FORCE,"A forced message"); endTrack("Runnable " + fI + ".3"); endTrack("Runnable " + fI); }); endTrack("Wrapper"); System.exit(1); startTrack("Hidden"); startTrack("Subhidden"); endTrack("Subhidden"); endTrack("Hidden"); startTrack(FORCE, "Shown"); startTrack(FORCE,"Subshown"); endTrack("Subshown"); endTrack("Shown"); log("^shown should have appeared above"); startTrack("Track 1.1"); log(WARN,FORCE,"some","something in 1.1"); logf("format string %s then int %d", "hello", 7);
private static <T> void log(RedwoodChannels channels, String description, Iterable<T> iterable) { Redwood.startTrack(description); if (iterable == null) { channels.log("(iterable is null)"); } else { int index = 0; for (T item : iterable) { if (dispatchable(item) && item != iterable) { log(channels, "Index " + index, item); } else { channels.logf("Index %d: %s", index, item == iterable ? "...<infinite loop>" : item); } index++; } if (index == 0) { channels.log("(empty)"); } } Redwood.endTrack(description); }
/** * A utility method for closing calls to the anonymous startTrack() call. */ public static void endTrack(){ endTrack(""); }
/** * A utility method for closing calls to the anonymous startTrack() call. */ public static void endTrack(){ endTrack(""); }
public static void endTrackIfOpen(String check) { if (!Redwood.titleStack.empty() && Redwood.titleStack.peek().equals(check)) { Redwood.endTrack(check); } } public static void endTracksUntil(String check) {
public static void endTrackIfOpen(String check) { if (!Redwood.titleStack.empty() && Redwood.titleStack.peek().equals(check)) { Redwood.endTrack(check); } } public static void endTracksUntil(String check) {
public static void endTracksUntil(String check) { while (!Redwood.titleStack.empty() && !Redwood.titleStack.peek().equals(check)) { Redwood.endTrack(Redwood.titleStack.peek()); } } public static void endTracksTo(String check) { endTracksUntil(check); endTrack(check); }
public static void endTracksUntil(String check) { while (!Redwood.titleStack.empty() && !Redwood.titleStack.peek().equals(check)) { Redwood.endTrack(Redwood.titleStack.peek()); } } public static void endTracksTo(String check) { endTracksUntil(check); endTrack(check); }
public static void endTracksUntil(String check) { while (!Redwood.titleStack.empty() && !Redwood.titleStack.peek().equals(check)) { Redwood.endTrack(Redwood.titleStack.peek()); } } public static void endTracksTo(String check) { endTracksUntil(check); endTrack(check); }
@Override public void run() { startTrack("Thread " + theI + " (" + Thread.currentThread().getId() + ")"); for(int time=0; time<5; time++){ log("tick " + time + " from " + theI + " (" + Thread.currentThread().getId() + ")"); try { Thread.sleep(50); } catch (Exception e) {} } endTrack("Thread " + theI + " (" + Thread.currentThread().getId() + ")"); finishThread(); } });