You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
📣 There are 4 5 ways to log content in the extension at the moment, all defined in logger.ts:
use @traceDecorators.[verbose|error|info|warn] decorators
use the static methods from the Logger class directly;
use the exported trace[Verbose|Error|Info|Warning] functions:
traceVerbose is used a lot for shell detection and interpreter auto selection rules (and some Jupyter kernel functions);
traceInfo seems to be used a lot in DS code (and a little bit in the core extension);
traceError is used everywhere;
traceWarning is mostly used in DS code (and a little bit in the core extension);
since we register a Logger instance in our service registry, it can be passed around as part of DI and its (static) methods are called via this.logger.[verbose|error|info|warn];
direct calls to (window.)console.[log|warn|error] methods, listed below: some of them are from DS overriding them, but non-DS calls should either use logging methods or be removed
💡 Conclusions:
consolidate the way we do logging
remove verbose output 🚮
move all logging to an output channel (either the exiting Python one or a separate one), and we can add a trace level flag (None, Error, Warning, Info, and optionally Verbose if we don't want to remove all these logs)
do we want CI-specific logging?
I started listing all uses cases but when I got to bullet point 3 (trace... functions) there were too many 🙅
traceDecorators uses
activation/activationManager.ts:
error level - Failed to activate workspace
activation/extensionSurvey.ts:
error level - Failed to check whether to display prompt for extension survey
error level - Failed to display prompt for extension survey
languageServer/activator.ts:
error level - Failed to activate language server
error level - Failed to ensure language server is available
languageServer/analysisOptions.ts:
error level - Failed to get analysis options
verbose level - Changes in python settings detected in analysis options
languageServer/languageServerFolderService.ts:
verbose level - Get language server folder name
verbose level - Retrieve latest LS package version info
languageServer/languageServerPackageService.ts:
verbose level - Retrieve latest LS package version info (called in languageServerFolderService.ts)
languageServer/languageServerProxy.ts:
verbose level - Stopping LS
error level - Failed to start LS
error level - Failed to load LS extension
languageServer/manager.ts:
error level - Failed to start LS (calls the function with the verbose 'Starting LS' trace in the same file)
error level - Failed to restart LS
verbose level - Restarting LS
verbose level - Starting LS (calls languageServerProxy..ts)
node/activator.ts:
error level - Failed to activate LS
node/languageServerProxy.ts:
verbose level - Stopping LS
error level - Failed to start LS
node/manager.ts:
error level - Failed to start LS (calls the function with the verbose 'Starting LS' trace in the same file)
error level - Failed to restart LS
verbose level - Restarting LS
verbose level - Starting LS (calls languageServerProxy..ts)
services/linuxCompatibilityService.ts: verbose level - Checking if 64bit Linux for .NET support (for LS)
services/unknownOsCompatibilityService.ts: info level - Unable to determine .NET support (for LS)
common/experiments.ts:
error level - Failed to identify if user is in experiment (calls sendTelemetryIfInExperiment which also has an error level decorator)
error level - Failed to populate user experiments (calls sendTelemetryIfInExperiment which also has an error level decorator, and theisUserInRange method can throw)
error level - Failed to send telemetry when user is in experiment
error level - Failed to initialize experiments (calls downloadAndStoreExperiments which also has its own error level trace decorator)
error level - Failed to download and store experiments
insidersBuild/downloadChannelRules.ts:
error level - Failed to check if we should look for a daily Insiders build (from accessing or modifying a global persistent state variable)
error level - Failed to check if we should look for a weekly Insiders build (from accessing or modifying a global persistent state variable)
insidersBuild/downloadChannelService.ts:
error level - Failed to update the Insiders channel setting
insidersBuild/insidersExtensionPrompt/ts:
error level - Error when prompting to install Insiders
error level - Error when prompting to reload after installing Insiders
insidersBuild/insidersExtensionService.ts:
error level - Failed when handling the Insiders channel (calls the checks if we should look for Insiders builds, install Insiders and prompt to reload)
installer/extensionBuildInstaller.ts:
error level - Failed to install the stable build of the extension (where is it used?)
error level - Failed to install the insiders build of the extension
nuget/azureBlobStoreNugetRepository.ts:
verbose level - List Nuget packages (LS logic)
process/pythonDaemonPool.ts:
error level - Failed to create Python daemon
error level - Failed to test whether the daemon is usable or not (by pinging it)
terminal/helper.ts:
error level - Failed to send terminal type telemetry
kernels/kernelService.ts:
error level - DS - Failed to register an interpreter as a kernel
error level - Failed to parse kernel creation stdout
activation/service.ts:
verbose level - Get activated environment variables
error level - Failed to parse environment output (to get env vars)
Activity
kimadeline commentedon Jan 20, 2020
To be done:
kimadeline commentedon Jan 20, 2020
📣 There are
45 ways to log content in the extension at the moment, all defined inlogger.ts:@traceDecorators.[verbose|error|info|warn]decoratorsLoggerclass directly;trace[Verbose|Error|Info|Warning]functions:traceVerboseis used a lot for shell detection and interpreter auto selection rules (and some Jupyter kernel functions);traceInfoseems to be used a lot in DS code (and a little bit in the core extension);traceErroris used everywhere;traceWarningis mostly used in DS code (and a little bit in the core extension);Loggerinstance in our service registry, it can be passed around as part of DI and its (static) methods are called viathis.logger.[verbose|error|info|warn];(window.)console.[log|warn|error]methods, listed below: some of them are from DS overriding them, but non-DS calls should either use logging methods or be removed💡 Conclusions:
I started listing all uses cases but when I got to bullet point 3 (
trace...functions) there were too many 🙅traceDecoratorsusesactivation/activationManager.ts:activation/extensionSurvey.ts:languageServer/activator.ts:languageServer/analysisOptions.ts:languageServer/languageServerFolderService.ts:languageServer/languageServerPackageService.ts:languageServerFolderService.ts)languageServer/languageServerProxy.ts:languageServer/manager.ts:languageServerProxy..ts)node/activator.ts:node/languageServerProxy.ts:node/manager.ts:languageServerProxy..ts)services/linuxCompatibilityService.ts: verbose level - Checking if 64bit Linux for .NET support (for LS)services/unknownOsCompatibilityService.ts: info level - Unable to determine .NET support (for LS)common/experiments.ts:sendTelemetryIfInExperimentwhich also has an error level decorator)sendTelemetryIfInExperimentwhich also has an error level decorator, and theisUserInRangemethod can throw)downloadAndStoreExperimentswhich also has its own error level trace decorator)insidersBuild/downloadChannelRules.ts:insidersBuild/downloadChannelService.ts:insidersBuild/insidersExtensionPrompt/ts:insidersBuild/insidersExtensionService.ts:installer/extensionBuildInstaller.ts:nuget/azureBlobStoreNugetRepository.ts:process/pythonDaemonPool.ts:terminal/helper.ts:kernels/kernelService.ts:activation/service.ts:rules/BaseRule.ts:display/progressDisplay.ts:locators/index.ts:locators/progressService.ts:services/cacheableLocatorService.ts:CacheableLocatorServiceservices/condaService.ts:services/interpreterWatcherBuilder.ts:services/windowsStoreInterpreter.ts:services/workspaceVirtualEnvWatcherService.ts:virtualEnvs/condaInheritEnvPrompt.ts:inheritEnvsetting for conda activation issuesinheritEnvprompt or update the settinginheritEnvprompt should be displayed or notvirtualEnvs/virtualEnvPrompt.ts:- error level - Error in the event handler when detecting a virtual env in the workspace and notifying user
common/updateTestSettings.ts:explorer/commandHandlers.ts:Direct calls to
Logger methodsand all thatchecks/powerShellActivation.ts:services/cacheableLocatorService.ts:services/condaService.ts:services/workspaceVirtualEnvWatcherService.ts:providers/jediProxy.ts:spawnProcess.endDirect uses of
console.console.calls to post messages to the web paneldatascience-ui/react-common/postOffice.ts-console.calls overriden herewebPanel.ts-console.logwebPanelServer.ts-console.logdatascience-ui/react-common/logger.ts-console.logsrc/test/:exitCIAfterTestReporter.ts: for tests (CI/AzDO)utils/ts: for functional testsdebuggerTest.ts: for debugger testsdatascience/: DS testsfeatureDeprecationManager.ts: notify deprecation (console.error) ➡️ can be moved to an output channelsocketServer.ts: error in socket server (console.error) ➡️ can be deleteddebugStreamProvider.ts: DA logging for third-party extension devs (console.error) ➡️ can be moved to a debug output channelLocalDebugClient.ts: debugging error logging (console.error) ➡️ can be moved to a debug output channelintellisenseDocument.ts: DS autocompletion (console.warn)container.ts: for tests (console.warn) ➡️ use a logging function insteadTodo/Questions:
@tracedecorators.funcList direct uses of(🙅 too many)traceError,traceInfoand friendsLogger.[verbose|error]List uses of logger in DI(🙅 too many)console.uses: which level?kimadeline commentedon Jan 22, 2020
Discussion output
windows.consoleLogging consolidation - Removewindow.consoleandconsole.calls #9721Loggerclass and DI logger instances Logging consolidation - Remove use of the Logger class #9722