Skip to content

Commit

Permalink
tryDispatch colored logging for stepped debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
karl-police committed Sep 18, 2024
1 parent e8a7acb commit 54da311
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Analysis/src/ConstraintSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <utility>

LUAU_FASTFLAGVARIABLE(DebugLuauLogSolver, false);
LUAU_FASTFLAGVARIABLE(DebugLuauLogSolverMoreDetails, false);
LUAU_FASTFLAGVARIABLE(DebugLuauLogSolverIncludeDependencies, false)
LUAU_FASTFLAGVARIABLE(DebugLuauLogBindings, false);
LUAU_FASTINTVARIABLE(LuauSolverRecursionLimit, 500);
Expand Down Expand Up @@ -418,14 +419,26 @@ void ConstraintSolver::run()
if (limits.cancellationToken && limits.cancellationToken->requested())
throwUserCancelError();

std::string saveMe = FFlag::DebugLuauLogSolver ? toString(*c, opts) : std::string{};
std::string constraintDumpStr = FFlag::DebugLuauLogSolver ? toString(*c, opts) : std::string{};
StepSnapshot snapshot;

if (logger)
{
snapshot = logger->prepareStepSnapshot(rootScope, c, force, unsolvedConstraints);
}

// More Debugging Info
if (FFlag::DebugLuauLogSolver && FFlag::DebugLuauLogSolverMoreDetails)
{
printf(
"\n" "\033[0;38;2;255;255;0m\033[48;2;20;20;20m" "tryDispatch:%s" "\033[K\033[39m" "\n"
"\t%s" "\033[0m" "\n\n",

(force ? " \033[7;38;2;50;50;0m!! Forced\033[27m" : ""),
constraintDumpStr.c_str()
);
}

bool success = tryDispatch(c, force);

progress |= success;
Expand Down Expand Up @@ -460,7 +473,7 @@ void ConstraintSolver::run()
{
if (force)
printf("Force ");
printf("Dispatched\n\t%s\n", saveMe.c_str());
printf("Dispatched\n\t%s\n", constraintDumpStr.c_str());

if (force)
{
Expand Down

0 comments on commit 54da311

Please sign in to comment.