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

object label during build with verbose logging #9060

Closed
1 task
fflaten opened this issue Nov 10, 2023 · 1 comment · Fixed by #9067
Closed
1 task

object label during build with verbose logging #9060

fflaten opened this issue Nov 10, 2023 · 1 comment · Fixed by #9067
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)

Comments

@fflaten
Copy link
Contributor

fflaten commented Nov 10, 2023

Astro Info

Astro                    v3.5.2
Node                     v18.16.0
System                   Linux (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             config-watcher
                         auto-import
                         @astrojs/sitemap
                         @astrojs/asides
                         astro-expressive-code
                         @astrojs/mdx

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Running build with vebose logging shows wrong label during page generation.
Repro: Create new project and run npm run build -- --verbose or pnpm build --verbose

 generating static routes 
▶ src/pages/index.astro
  astro:[object Object] build Generating: / [] +909ms
  └─ /index.html (+22ms)
Completed in 32ms.

  astro:[object Object] build Additional assets copied   1699642039.4s [] +10ms
07:47:22 PM [build] 1 page(s) built in 0.96s
07:47:22 PM [build] Complete!

What's the expected result?

Correct label

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-dxd52u?file=README.md

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Nov 10, 2023
@fflaten fflaten changed the title astro:[object Object] logger label during page generation object label during build with verbose logging Nov 10, 2023
@natemoo-re
Copy link
Member

@matthewp might have more context on this... I'm not sure why the signature of our debug function is different than all our other logging methods.

export function debug(...args: any[]) {
if ('_astroGlobalDebug' in globalThis) {
(globalThis as any)._astroGlobalDebug(...args);
}
}

It seems like modifying

export function debug(type: string, ...messages: Array<any>) {
to match the following fixes the problem, but it's a bit of a hack.

export function debug(type: string, ...messages: Array<any>) {
+	if (typeof type !== 'string') {
+		type = messages[0];
+		messages = messages.slice(1);
+	}
	const namespace = `astro:${type}`;
	debuggers[namespace] = debuggers[namespace] || debugPackage(namespace);
	return debuggers[namespace](...messages);
}

@natemoo-re natemoo-re added the - P3: minor bug An edge case that only affects very specific usage (priority) label Nov 10, 2023
@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants