for (K key : keys) { V value = mapping.get(key); if (!dispatchable(key) && dispatchable(value)) { log(channels, key.toString(), value); } else if (dispatchable(key) || dispatchable(value)) { Redwood.startTrack("Entry " + entryCounter); if (dispatchable(key)) { log(channels, "Key", key); } else { channels.logf("Key %s", key); if (dispatchable(value)) { log(channels, "Value", value); } else { channels.logf("Value %s", value);
/** * {@inheritDoc} */ public void prettyLog(RedwoodChannels channels, String description) { PrettyLogger.log(channels, description, map); } };
/** * PrettyLog an object with a description using these channels. */ public void prettyLog(String description, Object obj) { PrettyLogger.log(this, description, obj); }
/** * Pretty log an object along with its description. It will be logged to the * default channel. * * @param description * denote the object in the logs (via a track name, etc.). * @param obj * the object to be pretty logged */ public static void log(String description, Object obj) { log(DEFAULT_CHANNELS, description, obj); }
/** * {@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); }
@Override public void prettyLog(RedwoodChannels channels, String description) { PrettyLogger.log(channels, description, map); } }
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); }
/** * PrettyLog an object using these channels. A default description will be created * based on the type of obj. */ public void prettyLog(Object obj) { PrettyLogger.log(this, obj); }
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); }
public static void prettyLog(String description, Object obj){ PrettyLogger.log(description, obj); } public static void log(Object...objs){ Redwood.log(objs); }
for (K key : keys) { V value = mapping.get(key); if (!dispatchable(key) && dispatchable(value)) { log(channels, key.toString(), value); } else if (dispatchable(key) || dispatchable(value)) { Redwood.startTrack("Entry " + entryCounter); if (dispatchable(key)) { log(channels, "Key", key); } else { channels.logf("Key %s", key); if (dispatchable(value)) { log(channels, "Value", value); } else { channels.logf("Value %s", value);
public static void prettyLog(Object obj){ PrettyLogger.log(obj); } public static void prettyLog(String description, Object obj){ PrettyLogger.log(description, obj); }
for (K key : keys) { V value = mapping.get(key); if (!dispatchable(key) && dispatchable(value)) { log(channels, key.toString(), value); } else if (dispatchable(key) || dispatchable(value)) { Redwood.startTrack("Entry " + entryCounter); if (dispatchable(key)) { log(channels, "Key", key); } else { channels.logf("Key %s", key); if (dispatchable(value)) { log(channels, "Value", value); } else { channels.logf("Value %s", value);
/** * Pretty log an object. Its class name will be used as a description. * * @param channels * the channels to pretty log to * @param obj * the object to be pretty logged */ public static void log(RedwoodChannels channels, Object obj) { log(channels, obj.getClass().getSimpleName(), obj); }
for (K key : keys) { V value = mapping.get(key); if (!dispatchable(key) && dispatchable(value)) { log(channels, key.toString(), value); } else if (dispatchable(key) || dispatchable(value)) { Redwood.startTrack("Entry " + entryCounter); if (dispatchable(key)) { log(channels, "Key", key); } else { channels.logf("Key %s", key); if (dispatchable(value)) { log(channels, "Value", value); } else { channels.logf("Value %s", value);
/** * Pretty log an object. It will be logged to the default channel. Its class * name will be used as a description. * * @param obj * the object to be pretty logged */ public static void log(Object obj) { log(obj.getClass().getSimpleName(), obj); }
/** * {@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); }
/** * {@inheritDoc} */ public void prettyLog(RedwoodChannels channels, String description) { PrettyLogger.log(channels, description, this.asList()); } }
/** * {@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); }
/** * {@inheritDoc} */ public void prettyLog(RedwoodChannels channels, String description) { PrettyLogger.log(channels, description, Counters.asMap(this)); } }