@@ -18,10 +18,17 @@ export class SettingsService {
1818 private authService : AuthService
1919 private settings : OrganizationSettings | undefined = undefined
2020 private timer : RefreshTimer
21-
22- constructor ( context : vscode . ExtensionContext , authService : AuthService , callback : ( ) => void ) {
21+ private log : ( ...args : unknown [ ] ) => void
22+
23+ constructor (
24+ context : vscode . ExtensionContext ,
25+ authService : AuthService ,
26+ callback : ( ) => void ,
27+ log ?: ( ...args : unknown [ ] ) => void ,
28+ ) {
2329 this . context = context
2430 this . authService = authService
31+ this . log = log || console . log
2532
2633 this . timer = new RefreshTimer ( {
2734 callback : async ( ) => {
@@ -70,15 +77,19 @@ export class SettingsService {
7077 } )
7178
7279 if ( ! response . ok ) {
73- console . error ( `Failed to fetch organization settings: ${ response . status } ${ response . statusText } ` )
80+ this . log (
81+ "[cloud-settings] Failed to fetch organization settings:" ,
82+ response . status ,
83+ response . statusText ,
84+ )
7485 return false
7586 }
7687
7788 const data = await response . json ( )
7889 const result = organizationSettingsSchema . safeParse ( data )
7990
8091 if ( ! result . success ) {
81- console . error ( " Invalid organization settings format:", result . error )
92+ this . log ( "[cloud-settings] Invalid organization settings format:", result . error )
8293 return false
8394 }
8495
@@ -92,7 +103,7 @@ export class SettingsService {
92103
93104 return true
94105 } catch ( error ) {
95- console . error ( " Error fetching organization settings:", error )
106+ this . log ( "[cloud-settings] Error fetching organization settings:", error )
96107 return false
97108 }
98109 }
0 commit comments