|
Scala example source code file (SimpleTracer.scala)
The SimpleTracer.scala Scala example source codepackage scala.tools.nsc package util // todo: We should unify this with Tracer. I'd do it but Tracer is // too complicated for me to understand quickly. import java.io.PrintStream /** A simple tracer * @param out: The print stream where trace info should be sent * @param enabled: A condition that must be true for trace info to be produced. */ class SimpleTracer(out: PrintStream, enabled: Boolean = true) { def apply[T](msg: => String)(value: T): T = { if (enabled) out.println(msg+value) value } def when(enabled: Boolean): SimpleTracer = new SimpleTracer(out, enabled) } Other Scala source code examplesHere is a short list of links related to this Scala SimpleTracer.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.