Skip to content

Commit

Permalink
Improved verbose logging of execution environment information.
Browse files Browse the repository at this point in the history
  • Loading branch information
erictraut committed Sep 26, 2024
1 parent 6605ffc commit da667e6
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions packages/pyright-internal/src/analyzer/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,15 +501,28 @@ export class AnalyzerService {
if (this._commandLineOptions?.fromLanguageServer || this._configOptions.verboseOutput) {
const logLevel = this._configOptions.verboseOutput ? LogLevel.Info : LogLevel.Log;

for (const execEnv of this._configOptions.getExecutionEnvironments()) {
log(this._console, logLevel, `Execution environment: ${execEnv.root || '<default>'}`);
const execEnvs = [
this._configOptions.getDefaultExecEnvironment(),
...this._configOptions.getExecutionEnvironments(),
];

for (const execEnv of execEnvs) {
log(this._console, logLevel, `Execution environment: ${execEnv.name}`);
log(this._console, logLevel, ` Extra paths:`);
if (execEnv.extraPaths.length > 0) {
execEnv.extraPaths.forEach((path) => {
log(this._console, logLevel, ` ${path.toUserVisibleString()}`);
});
} else {
log(this._console, logLevel, ` (none)`);
}
log(this._console, logLevel, ` Python version: ${PythonVersion.toString(execEnv.pythonVersion)}`);
log(this._console, logLevel, ` Python platform: ${execEnv.pythonPlatform ?? 'All'}`);
log(this._console, logLevel, ` Search paths:`);
const roots = importResolver.getImportRoots(execEnv, /* forLogging */ true);
roots.forEach((path) => {
log(this._console, logLevel, ` ${path.toUserVisibleString()}`);
});
log(this._console, logLevel, ` Python version: ${PythonVersion.toString(execEnv.pythonVersion)}`);
log(this._console, logLevel, ` Python platform: ${execEnv.pythonPlatform ?? 'All'}`);
}
}

Expand Down

0 comments on commit da667e6

Please sign in to comment.