@@ -47,7 +47,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
47
47
) ;
48
48
}
49
49
50
- const output = vscode . window . createOutputChannel ( "Coder" ) ;
50
+ const output = vscode . window . createOutputChannel ( "Coder" , { log : true } ) ;
51
51
const storage = new Storage (
52
52
output ,
53
53
ctx . globalState ,
@@ -317,7 +317,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
317
317
}
318
318
} catch ( ex ) {
319
319
if ( ex instanceof CertificateError ) {
320
- storage . writeToCoderOutputChannel ( ex . x509Err || ex . message ) ;
320
+ storage . output . warn ( ex . x509Err || ex . message ) ;
321
321
await ex . showModal ( "Failed to open workspace" ) ;
322
322
} else if ( isAxiosError ( ex ) ) {
323
323
const msg = getErrorMessage ( ex , "None" ) ;
@@ -326,7 +326,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
326
326
const method = ex . config ?. method ?. toUpperCase ( ) || "request" ;
327
327
const status = ex . response ?. status || "None" ;
328
328
const message = `API ${ method } to '${ urlString } ' failed.\nStatus code: ${ status } \nMessage: ${ msg } \nDetail: ${ detail } ` ;
329
- storage . writeToCoderOutputChannel ( message ) ;
329
+ storage . output . warn ( message ) ;
330
330
await vscodeProposed . window . showErrorMessage (
331
331
"Failed to open workspace" ,
332
332
{
@@ -337,7 +337,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
337
337
) ;
338
338
} else {
339
339
const message = errToStr ( ex , "No error message was provided" ) ;
340
- storage . writeToCoderOutputChannel ( message ) ;
340
+ storage . output . warn ( message ) ;
341
341
await vscodeProposed . window . showErrorMessage (
342
342
"Failed to open workspace" ,
343
343
{
@@ -356,14 +356,12 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
356
356
// See if the plugin client is authenticated.
357
357
const baseUrl = restClient . getAxiosInstance ( ) . defaults . baseURL ;
358
358
if ( baseUrl ) {
359
- storage . writeToCoderOutputChannel (
360
- `Logged in to ${ baseUrl } ; checking credentials` ,
361
- ) ;
359
+ storage . output . info ( `Logged in to ${ baseUrl } ; checking credentials` ) ;
362
360
restClient
363
361
. getAuthenticatedUser ( )
364
362
. then ( async ( user ) => {
365
363
if ( user && user . roles ) {
366
- storage . writeToCoderOutputChannel ( "Credentials are valid" ) ;
364
+ storage . output . info ( "Credentials are valid" ) ;
367
365
vscode . commands . executeCommand (
368
366
"setContext" ,
369
367
"coder.authenticated" ,
@@ -381,17 +379,13 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
381
379
myWorkspacesProvider . fetchAndRefresh ( ) ;
382
380
allWorkspacesProvider . fetchAndRefresh ( ) ;
383
381
} else {
384
- storage . writeToCoderOutputChannel (
385
- `No error, but got unexpected response: ${ user } ` ,
386
- ) ;
382
+ storage . output . warn ( "No error, but got unexpected response" , user ) ;
387
383
}
388
384
} )
389
385
. catch ( ( error ) => {
390
386
// This should be a failure to make the request, like the header command
391
387
// errored.
392
- storage . writeToCoderOutputChannel (
393
- `Failed to check user authentication: ${ error . message } ` ,
394
- ) ;
388
+ storage . output . warn ( "Failed to check user authentication" , error ) ;
395
389
vscode . window . showErrorMessage (
396
390
`Failed to check user authentication: ${ error . message } ` ,
397
391
) ;
@@ -400,7 +394,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
400
394
vscode . commands . executeCommand ( "setContext" , "coder.loaded" , true ) ;
401
395
} ) ;
402
396
} else {
403
- storage . writeToCoderOutputChannel ( "Not currently logged in" ) ;
397
+ storage . output . info ( "Not currently logged in" ) ;
404
398
vscode . commands . executeCommand ( "setContext" , "coder.loaded" , true ) ;
405
399
406
400
// Handle autologin, if not already logged in.
0 commit comments