Jason Grout 5 lat temu
rodzic
commit
0f436d4219
1 zmienionych plików z 6 dodań i 0 usunięć
  1. 6 0
      packages/logconsole/src/logger.ts

+ 6 - 0
packages/logconsole/src/logger.ts

@@ -148,6 +148,12 @@ export class Logger implements ILogger {
    * @param source - The name of the log source.
    */
   constructor(options: Logger.IOptions) {
+    // There a number of places we test source names | null for truthiness, so
+    // insist that source names are nonempty strings. TODO: change these
+    // places to explicitly check for null.
+    if (options.source.length === 0) {
+      throw new Error('Log sources must be nonempty strings');
+    }
     this.source = options.source;
     this.outputAreaModel = new LoggerOutputAreaModel({
       contentFactory: new LogConsoleModelContentFactory(),