Commit 5858e3d

Anton Medvedev <anton@medv.io>
2022-06-06 17:06:34
Allow custom log entries
1 parent 5a3e890
Changed files (1)
src/log.ts
@@ -37,6 +37,7 @@ export type LogEntry =
       url: RequestInfo
       init?: RequestInit
     }
+  | { kind: 'custom'; data: any }
 
 export function log(entry: LogEntry) {
   switch (entry.kind) {
@@ -58,8 +59,6 @@ export function log(entry: LogEntry) {
       const init = entry.init ? ' ' + inspect(entry.init) : ''
       process.stderr.write('$ ' + colorize(`fetch ${entry.url}`) + init + '\n')
       break
-    default:
-      throw new Error(`Unknown log kind.`)
   }
 }