001 // Copyright 2008 Waterken Inc. under the terms of the MIT X license
002 // found at http://www.opensource.org/licenses/mit-license.html
003 package org.waterken.trace;
004
005 import java.lang.reflect.Member;
006
007 import org.ref_send.log.Trace;
008
009 /**
010 * Permission to produce stack traces.
011 */
012 public interface
013 Tracer {
014
015 /**
016 * Gets the current timestamp.
017 * @return difference, measured in milliseconds, between now and midnight,
018 * January 1, 1970 UTC
019 */
020 long timestamp();
021
022 /**
023 * Gets the text message from an exception.
024 * @param e exception to extract message from
025 */
026 String readException(Throwable e);
027
028 /**
029 * Gets the stack trace for a given exception.
030 * @param e exception to trace
031 */
032 Trace traceException(Throwable e);
033
034 /**
035 * Produces a dummy stack trace for a method.
036 * @param lambda sole member of the dummy stack trace
037 */
038 Trace traceMember(Member lambda);
039
040 /**
041 * Gets the current stack trace.
042 */
043 Trace traceHere();
044 }