Skip to content
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

Added some logging #15473

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/platform/common/process/logger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ export function logProcess(file: string, args: string[], options?: SpawnOptions)
return index === 0 ? formattedArg : `${accumulator} ${formattedArg}`;
}, '');

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some logging for testing

const message = [`Process Execution: ${getDisplayPath(file)} ${argsList}`];
const message = [
`Process Execution: ${getDisplayPath(file)} ${argsList} and Env Vars ${JSON.stringify(options?.env || {})}`
];
if (options && options.cwd) {
message.push(` > ${Logging.currentWorkingDirectory} ${getDisplayPath(options.cwd.toString())}`);
}
Expand Down
4 changes: 2 additions & 2 deletions src/platform/interpreter/environmentActivationService.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi
environment.path
)}, with env var count ${Object.keys(env || {}).length}. \n PATH value is ${
env.PATH
} and \n Path value is ${env.Path}`
} and \n Path value is ${env.Path}, and Env Vars are ${JSON.stringify(env)}`
);
} else if (envType === EnvironmentType.Conda) {
// We must get activated env variables for Conda env, if not running stuff against conda will not work.
Expand Down Expand Up @@ -300,7 +300,7 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi
traceVerbose(
`Activated Env Variables for ${getDisplayPath(environment.path)}, \n PATH value is ${
env.PATH
} and \n Path value is ${env.Path}`
} and \n Path value is ${env.Path} & env Vars ${JSON.stringify(env)}`
);
return env;
}
Expand Down
13 changes: 7 additions & 6 deletions src/platform/logging/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { argsToLogString, returnValueToLogString } from './util';
import { LoggingLevelSettingType } from '../common/types';
import { splitLines } from '../common/helpers';
import { getDisplayPath } from '../common/platform/fs-paths';
let homeAsLowerCase = '';
// let homeAsLowerCase = '';
const DEFAULT_OPTS: TraceOptions = TraceOptions.Arguments | TraceOptions.ReturnValue;

let loggers: ILogger[] = [];
Expand Down Expand Up @@ -41,8 +41,8 @@ export function setLoggingLevel(level?: LoggingLevelSettingType | number): void
globalLoggingLevel = typeof level === 'number' ? level : logLevelMap.get(level) ?? LogLevel.Error;
}

export function setHomeDirectory(homeDir: string) {
homeAsLowerCase = homeDir.toLowerCase();
export function setHomeDirectory(_homeDir: string) {
// homeAsLowerCase = homeDir.toLowerCase();
}

export function traceLog(message: string, ...args: Arguments): void {
Expand Down Expand Up @@ -273,9 +273,10 @@ function isUri(resource?: Uri | any): resource is Uri {
}

function removeUserPaths(value: string) {
// Where possible strip user names from paths, then users will be more likely to provide the logs.
const indexOfStart = homeAsLowerCase ? value.toLowerCase().indexOf(homeAsLowerCase) : -1;
return indexOfStart === -1 ? value : `~${value.substring(indexOfStart + homeAsLowerCase.length)}`;
return value;
// // Where possible strip user names from paths, then users will be more likely to provide the logs.
// const indexOfStart = homeAsLowerCase ? value.toLowerCase().indexOf(homeAsLowerCase) : -1;
// return indexOfStart === -1 ? value : `~${value.substring(indexOfStart + homeAsLowerCase.length)}`;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function formatArgument(target: Object, method: MethodName, arg: any, parameterIndex: number) {
Expand Down