MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / initializeLoggers

Function initializeLoggers

src/extension.common.ts:49–96  ·  view source on GitHub ↗
(
    context: IExtensionContext,
    options: {
        addConsoleLogger: boolean;
        userNameRegEx?: RegExp;
        homePathRegEx?: RegExp;
        platform?: string;
        arch?: string;
        homePath?: string;
    }
)

Source from the content-addressed store, hash-verified

47import { getExtensionTempDir } from './platform/common/temp';
48
49export async function initializeLoggers(
50 context: IExtensionContext,
51 options: {
52 addConsoleLogger: boolean;
53 userNameRegEx?: RegExp;
54 homePathRegEx?: RegExp;
55 platform?: string;
56 arch?: string;
57 homePath?: string;
58 }
59) {
60 const standardOutputChannel = init(options);
61 // Log env info.
62 standardOutputChannel.appendLine(`${env.appName} (${version}, ${env.remoteName}, ${env.appHost})`);
63 standardOutputChannel.appendLine(`Jupyter Extension Version: ${context.extension.packageJSON['version']}.`);
64 const pythonExtension = extensions.getExtension(PythonExtension);
65 if (pythonExtension) {
66 standardOutputChannel.appendLine(`Python Extension Version: ${pythonExtension.packageJSON['version']}.`);
67 } else {
68 standardOutputChannel.appendLine('Python Extension not installed.');
69 }
70 const pythonEnvironmentExtension = extensions.getExtension(PythonEnvironmentExtension);
71 if (pythonEnvironmentExtension) {
72 standardOutputChannel.appendLine(
73 `Python Environment Extension Version: ${pythonEnvironmentExtension.packageJSON['version']}.`
74 );
75 } else {
76 standardOutputChannel.appendLine('Python Environment Extension not installed.');
77 }
78 if (options?.platform) {
79 standardOutputChannel.appendLine(`Platform: ${options.platform} (${options.arch}).`);
80 }
81 standardOutputChannel.appendLine(`Home = ${options?.homePath}`);
82 standardOutputChannel.appendLine(`Temp Storage folder ${getDisplayPath(await getExtensionTempDir(context))}`);
83 if (!workspace.workspaceFolders || workspace.workspaceFolders.length === 0) {
84 standardOutputChannel.appendLine(`No workspace folder opened.`);
85 } else if (workspace.workspaceFolders.length === 1) {
86 standardOutputChannel.appendLine(`Workspace folder ${getDisplayPath(workspace.workspaceFolders[0].uri)}`);
87 } else {
88 standardOutputChannel.appendLine(
89 `Multiple Workspace folders opened ${workspace.workspaceFolders
90 .map((item) => getDisplayPath(item.uri))
91 .join(', ')}`
92 );
93 }
94
95 return standardOutputChannel;
96}
97
98export function initializeGlobals(
99 context: IExtensionContext,

Callers 2

activateFunction · 0.90
activateFunction · 0.90

Calls 5

getDisplayPathFunction · 0.90
getExtensionTempDirFunction · 0.90
joinMethod · 0.80
mapMethod · 0.80
appendLineMethod · 0.45

Tested by

no test coverage detected