@@ -47,7 +47,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
4747 ) ;
4848 }
4949
50- const output = vscode . window . createOutputChannel ( "Coder" ) ;
50+ const output = vscode . window . createOutputChannel ( "Coder" , { log : true } ) ;
5151 const storage = new Storage (
5252 output ,
5353 ctx . globalState ,
@@ -317,7 +317,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
317317 }
318318 } catch ( ex ) {
319319 if ( ex instanceof CertificateError ) {
320- storage . writeToCoderOutputChannel ( ex . x509Err || ex . message ) ;
320+ storage . output . warn ( ex . x509Err || ex . message ) ;
321321 await ex . showModal ( "Failed to open workspace" ) ;
322322 } else if ( isAxiosError ( ex ) ) {
323323 const msg = getErrorMessage ( ex , "None" ) ;
@@ -326,7 +326,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
326326 const method = ex . config ?. method ?. toUpperCase ( ) || "request" ;
327327 const status = ex . response ?. status || "None" ;
328328 const message = `API ${ method } to '${ urlString } ' failed.\nStatus code: ${ status } \nMessage: ${ msg } \nDetail: ${ detail } ` ;
329- storage . writeToCoderOutputChannel ( message ) ;
329+ storage . output . warn ( message ) ;
330330 await vscodeProposed . window . showErrorMessage (
331331 "Failed to open workspace" ,
332332 {
@@ -337,7 +337,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
337337 ) ;
338338 } else {
339339 const message = errToStr ( ex , "No error message was provided" ) ;
340- storage . writeToCoderOutputChannel ( message ) ;
340+ storage . output . warn ( message ) ;
341341 await vscodeProposed . window . showErrorMessage (
342342 "Failed to open workspace" ,
343343 {
@@ -356,14 +356,12 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
356356 // See if the plugin client is authenticated.
357357 const baseUrl = restClient . getAxiosInstance ( ) . defaults . baseURL ;
358358 if ( baseUrl ) {
359- storage . writeToCoderOutputChannel (
360- `Logged in to ${ baseUrl } ; checking credentials` ,
361- ) ;
359+ storage . output . info ( `Logged in to ${ baseUrl } ; checking credentials` ) ;
362360 restClient
363361 . getAuthenticatedUser ( )
364362 . then ( async ( user ) => {
365363 if ( user && user . roles ) {
366- storage . writeToCoderOutputChannel ( "Credentials are valid" ) ;
364+ storage . output . info ( "Credentials are valid" ) ;
367365 vscode . commands . executeCommand (
368366 "setContext" ,
369367 "coder.authenticated" ,
@@ -381,17 +379,13 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
381379 myWorkspacesProvider . fetchAndRefresh ( ) ;
382380 allWorkspacesProvider . fetchAndRefresh ( ) ;
383381 } else {
384- storage . writeToCoderOutputChannel (
385- `No error, but got unexpected response: ${ user } ` ,
386- ) ;
382+ storage . output . warn ( "No error, but got unexpected response" , user ) ;
387383 }
388384 } )
389385 . catch ( ( error ) => {
390386 // This should be a failure to make the request, like the header command
391387 // errored.
392- storage . writeToCoderOutputChannel (
393- `Failed to check user authentication: ${ error . message } ` ,
394- ) ;
388+ storage . output . warn ( "Failed to check user authentication" , error ) ;
395389 vscode . window . showErrorMessage (
396390 `Failed to check user authentication: ${ error . message } ` ,
397391 ) ;
@@ -400,7 +394,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
400394 vscode . commands . executeCommand ( "setContext" , "coder.loaded" , true ) ;
401395 } ) ;
402396 } else {
403- storage . writeToCoderOutputChannel ( "Not currently logged in" ) ;
397+ storage . output . info ( "Not currently logged in" ) ;
404398 vscode . commands . executeCommand ( "setContext" , "coder.loaded" , true ) ;
405399
406400 // Handle autologin, if not already logged in.
0 commit comments