Turn some logInfo into trace[debug] to toggle the off for building

world_overviews
joneugster 3 years ago
parent 19592668ae
commit cc4321ff3f

@ -1,4 +1,5 @@
import Lean import Lean
import GameServer.Utils
section AbstractCtx section AbstractCtx
open Lean open Lean

@ -10,13 +10,14 @@ register_option lean4game.showDependencyReasons : Bool := {
descr := "show reasons for calculated world dependencies." descr := "show reasons for calculated world dependencies."
} }
/-- Let `MakeGame` print the reasons why the worlds depend on each other. -/ /-- Let `MakeGame` print the reasons why the worlds depend on each other.
Note: currently unused in favour of setting `set_option trace.debug true`. -/
register_option lean4game.verbose : Bool := { register_option lean4game.verbose : Bool := {
defValue := false defValue := false
descr := "display more info messages to help developing the game." descr := "display more info messages to help developing the game."
} }
/-! # Game metadata -/ /-! # Game metadata -/
/-- Switch to the specified `Game` (and create it if non-existent). Example: `Game "NNG"` -/ /-- Switch to the specified `Game` (and create it if non-existent). Example: `Game "NNG"` -/
@ -182,7 +183,6 @@ def checkInventoryDoc (type : InventoryType) (ref : Ident) (name : Name := ref.g
name := name name := name
category := if type == .Lemma then s!"{n.getPrefix}" else "" category := if type == .Lemma then s!"{n.getPrefix}" else ""
content := s }) content := s })
if lean4game.verbose.get (← getOptions) then
logInfoAt ref (m!"Missing {type} Documentation: {name}, used default (e.g. provided " ++ logInfoAt ref (m!"Missing {type} Documentation: {name}, used default (e.g. provided " ++
m!"docstring) instead. If you want to write a different description, add " ++ m!"docstring) instead. If you want to write a different description, add " ++
m!"`{type}Doc {name}` somewhere above this statement.") m!"`{type}Doc {name}` somewhere above this statement.")
@ -589,12 +589,11 @@ elab (name := GameServer.Tactic.Branch) "Branch" t:tacticSeq : tactic => do
Tactic.evalTactic t Tactic.evalTactic t
-- Show an info whether the branch proofs all remaining goals. -- Show an info whether the branch proofs all remaining goals.
if lean4game.verbose.get (← getOptions) then
let gs ← Tactic.getUnsolvedGoals let gs ← Tactic.getUnsolvedGoals
if gs.isEmpty then if gs.isEmpty then
logInfo "This branch finishes the proof." trace[debug] "This branch finishes the proof."
else else
logInfo "This branch leaves open goals." trace[debug] "This branch leaves open goals."
let msgs ← Core.getMessageLog let msgs ← Core.getMessageLog
b.restore b.restore
@ -639,8 +638,7 @@ elab "Template" tacs:tacticSeq : tactic => do
Tactic.evalTactic tacs Tactic.evalTactic tacs
let newTacs : TSyntax `Lean.Parser.Tactic.tacticSeq := ⟨replaceHoles tacs.raw⟩ let newTacs : TSyntax `Lean.Parser.Tactic.tacticSeq := ⟨replaceHoles tacs.raw⟩
let template ← PrettyPrinter.ppCategory `Lean.Parser.Tactic.tacticSeq newTacs let template ← PrettyPrinter.ppCategory `Lean.Parser.Tactic.tacticSeq newTacs
if lean4game.verbose.get (← getOptions) then trace[debug] s!"Template:\n{template}"
logInfo s!"Template:\n{template}"
modifyLevel (←getCurLevelId) fun level => do modifyLevel (←getCurLevelId) fun level => do
return {level with template := s!"{template}"} return {level with template := s!"{template}"}
@ -1071,7 +1069,6 @@ elab "MakeGame" : command => do
modifyLevel ⟨← getCurGameId, worldId, levelId⟩ fun level => do modifyLevel ⟨← getCurGameId, worldId, levelId⟩ fun level => do
return level.setComputedInventory inventoryType itemsArray return level.setComputedInventory inventoryType itemsArray
/-! # Debugging tools -/ /-! # Debugging tools -/
-- /-- Print current game for debugging purposes. -/ -- /-- Print current game for debugging purposes. -/

@ -22,7 +22,7 @@ Statement foo.bar2 : 3 ≤ 7 := by
simp simp
NewLemma foo.baz NewLemma foo.bar
DisabledTactic tauto DisabledTactic tauto

Loading…
Cancel
Save