LogTape doesn't work on Cloudflare Workers
Closed this issue · 2 comments
kitsonk commented
There appear to be two issues that prevent logtape from working on Cloudflare Workers:
- Cloudflare Workers fails on the import of
node:fs
as it isn't supported, even under node compat mode. I suspect this can be worked around by expanding thefilesink.web.ts
to be a full implementation and determine and then dynamically load that. - The
LoggerImpl
usesWeakRef
, which Cloudflare Workers don't support. They claim there are some limitations/challenges to this, though the details are very vague. In logtape, this appears to be isolated to managing "child" loggers so that that they can be enumerated but not hold a strong reference so any children can be GC'ed. I don't know of an easy workaround to this.
dahlia commented
Given the short lifetime of edge functions like Cloudflare Workers, it might not be necessary to use WeakRef
s in that environment. I'm not sure though. 🤔
dahlia commented
I've just released LogTape 0.4.2, which must work on Cloudflare Workers.
@kitsonk Check it out!