/** * {@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); }
@Override public void prettyLog(RedwoodChannels channels, String description) { PrettyLogger.log(channels, description, map); } }
/** * 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); }
public static void prettyLog(String description, Object obj){ PrettyLogger.log(description, obj); } public static void log(Object...objs){ Redwood.log(objs); }
public static void prettyLog(Object obj){ PrettyLogger.log(obj); } public static void prettyLog(String description, Object obj){ PrettyLogger.log(description, obj); }
/** * 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); }
/** * 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} */ public void prettyLog(RedwoodChannels channels, String description) { PrettyLogger.log(channels, description, this.asList()); } }
/** * {@inheritDoc} */ public void prettyLog(RedwoodChannels channels, String description) { PrettyLogger.log(channels, description, Counters.asMap(this)); } }
/** * {@inheritDoc} */ public void prettyLog(RedwoodChannels channels, String description) { PrettyLogger.log(channels, description, asMap(this)); } };
/** * {@inheritDoc} */ public void prettyLog(RedwoodChannels channels, String description) { PrettyLogger.log(channels, description, this.asList()); } }
/** * {@inheritDoc} */ @Override public void prettyLog(RedwoodChannels channels, String description) { PrettyLogger.log(channels, description, Counters.asMap(this)); }
/** * {@inheritDoc} */ public void prettyLog(RedwoodChannels channels, String description) { PrettyLogger.log(channels, description, this.asList()); }
/** * {@inheritDoc} */ public void prettyLog(RedwoodChannels channels, String description) { PrettyLogger.log(channels, description, this.asList()); }
private static <K,V> void log(RedwoodChannels channels, String description, Dictionary<K,V> dict) { //(a real data structure) Map<K, V> map = Generics.newHashMap(); //(copy to map) Enumeration<K> keys = dict.keys(); while(keys.hasMoreElements()){ K key = keys.nextElement(); V value = dict.get(key); map.put(key,value); } //(log like normal) log(channels, description, map); }
/** * {@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); }
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); }