Skip to content

Make -Ylog:X log only phase X #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions src/dotty/tools/dotc/reporting/Reporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,9 @@ trait Reporting { this: Context =>
def incompleteInputError(msg: String, pos: SourcePosition = NoSourcePosition)(implicit ctx: Context): Unit =
reporter.incomplete(new Error(msg, pos))(ctx)

/** Log msg if current phase or its precedessor is mentioned in
* settings.log.
* The reason we also pick the predecessor is that during the
* tree transform of phase X, we often are already in phase X+1.
* It's convenient to have logging work independently of whether
* we have advanced the phase or not.
*/
/** Log msg if current phase is mentioned in settings.log */
def log(msg: => String): Unit =
if (this.settings.log.value.containsPhase(phase) ||
this.settings.log.value.containsPhase(phase.prev))
if (this.settings.log.value.containsPhase(phase))
echo(s"[log ${ctx.phasesStack.reverse.mkString(" -> ")}] $msg")

def debuglog(msg: => String): Unit =
Expand Down