Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/content/docs/en/guides/upgrade-to/v7.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,25 @@ Experimental flags allow you to opt in to features while they are in early devel

Remove these experimental flags from your Astro config if you were previously using them:

```js del={5-8} title="astro.config.mjs"
```js del={5-9} title="astro.config.mjs"
import { defineConfig } from 'astro/config';

export default defineConfig({
experimental: {
logger: logHandlers.json({ pretty: true }),
queuedRendering: {
enabled: true,
},
rustCompiler: true,
advancedRouting: true,
},
});
})
```

#### Experimental features now stable:

- `logger`: The new logging system is now stable and the experimental flag is no longer needed to use it. If you were using this flag, you can now set your logger directly in the top-level `logger` field of your Astro config.

- `queuedRendering`: Queued rendering is now the default behavior, and the experimental flag has been removed. No action is required to enable this feature in your project. All projects now benefit from the improved performance.

- `rustCompiler`: The Rust-based Astro compiler is now the default and only compiler, replacing the previous Go-based compiler. No action is required for most projects. If you encounter any issues, please report them on [GitHub](https://github.com/withastro/astro/issues).
Expand Down
49 changes: 14 additions & 35 deletions src/content/docs/en/reference/logger-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ The following example defines a custom logger exported by the `@org/custom-logge
import { defineConfig } from 'astro/config';

export default defineConfig({
experimental: {
logger: {
entrypoint: "@org/custom-logger",
config: {
level: "warn"
}
logger: {
entrypoint: "@org/custom-logger",
config: {
level: "warn"
}
}
});
Expand Down Expand Up @@ -86,9 +84,7 @@ The following example configures the JSON logger to print only messages that hav
import { defineConfig, logHandlers } from 'astro/config';

export default defineConfig({
experimental: {
logger: logHandlers.json({ level: "warn" })
}
logger: logHandlers.json({ level: "warn" })
});
```

Expand Down Expand Up @@ -128,9 +124,7 @@ The `json` logger accepts the following options:
import { defineConfig, logHandlers } from 'astro/config';

export default defineConfig({
experimental: {
logger: logHandlers.json({ pretty: true })
}
logger: logHandlers.json({ pretty: true })
});
```

Expand Down Expand Up @@ -158,9 +152,7 @@ The `console` logger accepts the following options:
import { defineConfig, logHandlers } from 'astro/config';

export default defineConfig({
experimental: {
logger: logHandlers.console({ level: 'warn' })
}
logger: logHandlers.console({ level: 'warn' })
});
```

Expand All @@ -186,13 +178,11 @@ The `node` logger accepts the following options:
import { defineConfig, logHandlers } from 'astro/config';

export default defineConfig({
experimental: {
logger: logHandlers.node({ level: 'warn' })
}
logger: logHandlers.node({ level: 'warn' })
});
```

### `logHandlers.compose`
### `logHandlers.compose()`

A particular function that allows configuring multiple loggers in an arbitrary order. The same message is broadcast to all loggers.

Expand All @@ -202,18 +192,13 @@ The following example composes the console logger and JSON logger using the defa
import { defineConfig, logHandlers } from 'astro/config';

export default defineConfig({
experimental: {
logger: logHandlers.compose(
logHandlers.console(),
logHandlers.json()
)
}
logger: logHandlers.compose(
logHandlers.console(),
logHandlers.json()
)
});
```




## Types reference

The following types can be imported from the `astro` specifier.
Expand Down Expand Up @@ -251,13 +236,6 @@ An optional function called before a server is shut down. This function is usual

### `AstroLoggerLevel`

The level of the message. Available variants:
- `'debug'`
- `'info'`
- `'warn'`
- `'error'`
### `AstroLoggerLevel`

<p>

**Type:** `'debug' |'info' |'warn' | 'error' | 'silent'`
Expand All @@ -274,6 +252,7 @@ Specifies the verbosity level of logs:

**Type:** `{ label: string | null; level: AstroLoggerLevel; message: string; newLine: boolean; }`
</p>

The incoming object from the [`AstroLoggerDestination.write()`](#astrologgerdestinationwrite) function:
- `message`: the message being logged.
- `level`: the level of the message.
Expand Down
11 changes: 11 additions & 0 deletions src/content/docs/en/reference/modules/astro-config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ import {
envField,
fontProviders,
getViteConfig,
logHandlers,
mergeConfig,
passthroughImageService,
sessionDrivers,
Expand Down Expand Up @@ -307,6 +308,16 @@ Describes the [built-in provider](/en/reference/font-provider-reference/#built-i

Retrieves the Vite configuration to use by merging a custom Vite configuration object and an optional Astro configuration object. This is useful [to set up Vitest for testing](/en/guides/testing/#vitest).

### `logHandlers`

<p>

**Type:** `object`<br />
<Since v="7.0.0" />
</p>

Describes the [available built-in log handlers](/en/reference/logger-reference/#built-in-loggers) that can be used to [configure a logger](/en/reference/configuration-reference/#logger-options) in your Astro configuration.

### `mergeConfig()`

See [`mergeConfig()` in the Programmatic API reference](/en/reference/programmatic-reference/#mergeconfig).
Expand Down
Loading