MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / logToUserBuffered

Function logToUserBuffered

src/debug/dart_debug_impl.ts:1844–1861  ·  view source on GitHub ↗
(message: string, category: string)

Source from the content-addressed store, hash-verified

1842 /// [5:01:50 PM] [General] [Info] [stderr] e:///D:/a/
1843 /// [5:01:50 PM] [General] [Info] [stderr] Dart Code/Dart-Code/src/test/test_projects/hello_world/bin/broken.dart:2:3)
1844 protected logToUserBuffered(message: string, category: string) {
1845 this.logBufferFlushes[category]?.close();
1846 this.logBuffer[category] = this.logBuffer[category] || "";
1847 this.logBuffer[category] += message;
1848
1849 const lastNewLine = this.logBuffer[category].lastIndexOf("\n");
1850 if (lastNewLine !== -1) {
1851 const processString = this.logBuffer[category].substr(0, lastNewLine + 1);
1852 this.logBuffer[category] = this.logBuffer[category].substr(lastNewLine + 1);
1853 this.logToUser(processString, category);
1854 } else {
1855 // If we don't get another message we need to ensure the buffer is flushed after some
1856 // small period.
1857 const timeout = setTimeout(() => this.flushLogBuffer(category), 50);
1858 timeout.unref();
1859 this.logBufferFlushes[category] = timeout;
1860 }
1861 }
1862 private logBuffer: { [key: string]: string } = {};
1863 private logBufferFlushes: { [key: string]: NodeJS.Timeout } = {};
1864

Callers

nothing calls this directly

Calls 1

closeMethod · 0.80

Tested by

no test coverage detected