@Override public SourceLocation getSourceLocation() { if (this.sourceLocation == null) { this.sourceLocation = new SourceLocationImpl(); } return this.sourceLocation; }
public TracingEvent(final TraceType traceType, final Class<? extends Object> source, final Class<? extends Object> target, final Signature signature, final SourceLocation sourceLocation, final Object... args) { this.traceType = traceType; this.source = source; this.target = target; this.signature = signature; this.sourceLocation = sourceLocation; this.args = args; }
private void traceEntry(final Class<? extends Object> aThis, final Class<? extends Object> target, final Signature signature, final SourceLocation sourceLocation, final Object[] args) { if(aThis != null && target != null) { String message = aThis.getName() + " -> " + target.getName() + " : " + signature.getName() + "(" + Arrays.deepToString(args) + ")"; messages.add(new TracingEvent(TraceType.ENTRY, aThis, target, signature, sourceLocation, args)); System.out.println(message); } }
private void traceExit(final Class<? extends Object> aThis, final Class<? extends Object> target, final Signature signature, final SourceLocation sourceLocation, final Object... returnValue) { if(aThis != null && target != null) { String message = target.getName() + " -> " + aThis.getName() + " : return" + "(" + Arrays.deepToString(returnValue) + ")"; messages.add(new TracingEvent(TraceType.EXIT, aThis, target, signature, sourceLocation, returnValue)); System.out.println(message); } }
private void traceThrowing(final Class<? extends Object> aThis, final Class<? extends Object> target, final Signature signature, final SourceLocation sourceLocation, final Throwable throwable) { if(aThis != null && target != null) { String message = target.getName() + " -> " + aThis.getName() + " : throws" + "(" + throwable + ")"; messages.add(new TracingEvent(TraceType.EXCEPTION, aThis, target, signature, sourceLocation, throwable)); System.out.println(message); } }
/** * Before outputting the message inject additional context. * * @param joinPoint The <code>JoinPoint</code>. */ @Before("call(* com.arpnetworking.steno.LogBuilder.log())") public void addToContextLineAndMethod(final JoinPoint joinPoint) { final SourceLocation sourceLocation = joinPoint.getSourceLocation(); final LogBuilder targetLogBuilder = (LogBuilder) joinPoint.getTarget(); targetLogBuilder.addContext("line", String.valueOf(sourceLocation.getLine())); targetLogBuilder.addContext("file", sourceLocation.getFileName()); targetLogBuilder.addContext("class", sourceLocation.getWithinType()); }
private static Class<?> getType(JoinPoint jp) { return Optional.ofNullable(jp.getSourceLocation()) .map(SourceLocation::getWithinType) .orElse(jp.getSignature().getDeclaringType()); }
@Override public SourceLocation getSourceLocation() { return null; }
public SourceLocation getSourceLocation() { return null; }
/** * {@inheritDoc} */ @Override public SourceLocation getSourceLocation() { return joinPoint.getSourceLocation(); }
public SourceLocation getSourceLocation() { if (this.sourceLocation == null) { this.sourceLocation = new SourceLocationImpl(); } return this.sourceLocation; }
public SourceLocation getSourceLocation() { return sourceLocation; }
@Override public SourceLocation getSourceLocation() { return this.joinpoint.getSourceLocation(); }