| 226 | } |
| 227 | |
| 228 | export function attachLoggingWhenExtensionAvailable(attempt = 1) { |
| 229 | if (logger && !(logger instanceof BufferedLogger)) { |
| 230 | console.warn("Logging was already set up!"); |
| 231 | return; |
| 232 | } |
| 233 | |
| 234 | if (setupTestLogging()) { |
| 235 | // console.log("Logging was configured!"); |
| 236 | return; |
| 237 | } |
| 238 | |
| 239 | if (attempt < 50) { |
| 240 | setTimeout(() => attachLoggingWhenExtensionAvailable(attempt + 1), 100); |
| 241 | } else { |
| 242 | console.warn(`Failed to set up logging after ${attempt} attempts`); |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | function setupTestLogging(): boolean { |
| 247 | const ext = vs.extensions.getExtension(dartCodeExtensionIdentifier)!; |