Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: console.dir support #2247

Open
Cherry opened this issue Oct 29, 2023 · 1 comment
Open

🐛 BUG: console.dir support #2247

Cherry opened this issue Oct 29, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@Cherry
Copy link
Contributor

Cherry commented Oct 29, 2023

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 cloudflare/workers-sdk#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:

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.

@jasonkuhrt
Copy link

This issue makes OTEL harder to use with Cloudflare because the Console Exporter uses console.dir: https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-sdk-trace-base/src/export/ConsoleSpanExporter.ts#L93.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

2 participants