cloudflare / cloudflare/workerd

🐛 BUG: console.dir support

Open
#2,247 3 comments 4 reactions 1 assignee Claimed by @anonrig View on GitHub
bug
Dominant language
C++
Stars
8.7k
Forks
739
Avg merge
2d 20h
Merged PRs (30d)
174

Description

### Which Cloudflare product(s) does this pertain to?

Wrangler core

### What version(s) of the tool(s) are you using?

3.15.0

### What version of Node are you using?

20.9.0

### What operating system are you using?

Windows 11

### Describe the Bug

Much improved console logging landed in https://github.com/cloudflare/workers-sdk/issues/3591 which is fantastic, but it seems a small regression (ish) has been introduced with `console.dir`. The output with `3.14.0` wasn't really useful anyway, so this is very minor.

Script:
```javascript
export default {
fetch(request) {
console.dir({
foo: {
bar: {
baz: {
foo: {
bar: true
}
}
}
}
}, {depth: null})
return new Response('ok');
}
}
```

I then spun up various versions of wrangler and hit each of them once to get the log:

wrangler 2 (`npx wrangler@2.20.1 dev --local logging.js)`:
```
{
foo: {
bar: { baz: { foo: { bar: true } } }
}
}
```

wrangler 3.14.0 (`npx wrangler@3.14.0 dev logging.js`)
```
[ 'Object', '{\n foo: Object\n}', 'Object', '{\n depth: null\n}' ]
```

wrangler 3.15.0 (`npx wrangler@3.15.0 dev logging.js`)
```

```
(intentionally empty. Nothing happens, it doesn't error, it just seems to swallow it entirely)

Ideally, this would be supported and work like wrangler 2.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.