You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/configuration/overview.mdx
+80-6Lines changed: 80 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,7 @@ The following options are available:
77
77
|**`globals`**| An array of Globals for Payload to manage. [More details](./globals). |
78
78
|**`cors`**| Cross-origin resource sharing (CORS) is a mechanism that accept incoming requests from given domains. You can also customize the `Access-Control-Allow-Headers` header. [More details](#cors). |
79
79
|**`localization`**| Opt-in to translate your content into multiple locales. [More details](./localization). |
80
-
|**`logger`**| Logger options, logger options with a destination stream, or an instantiated logger instance. [More details](https://getpino.io/#/docs/api?id=options).|
80
+
|**`logger`**| Logger options, logger options with a destination stream, or an instantiated logger instance. [More details](#logger). |
81
81
|**`loggingLevels`**| An object to override the level to use in the logger for Payload's errors. |
82
82
|**`graphQL`**| Manage GraphQL-specific functionality, including custom queries and mutations, query complexity limits, etc. [More details](../graphql/overview#graphql-options). |
83
83
|**`cookiePrefix`**| A string that will be prefixed to all cookies that Payload sets. |
|**`autoGenerate`**| By default, Payload will auto-generate TypeScript interfaces for all collections and globals that your config defines. Opt out by setting `typescript.autoGenerate: false`. [More details](../typescript/overview). |
137
-
|**`declare`**| By default, Payload adds a `declare` block to your generated types, which makes sure that Payload uses your generated types for all Local API methods. Opt out by setting `typescript.declare: false`. |
138
-
|**`outputFile`**| Control the output path and filename of Payload's auto-generated types by defining the `typescript.outputFile` property to a full, absolute path. |
|**`autoGenerate`**| By default, Payload will auto-generate TypeScript interfaces for all collections and globals that your config defines. Opt out by setting `typescript.autoGenerate: false`. [More details](../typescript/overview). |
137
+
|**`declare`**| By default, Payload adds a `declare` block to your generated types, which makes sure that Payload uses your generated types for all Local API methods. Opt out by setting `typescript.declare: false`. |
138
+
|**`outputFile`**| Control the output path and filename of Payload's auto-generated types by defining the `typescript.outputFile` property to a full, absolute path. |
139
139
|**`strictDraftTypes`**| Enable strict type safety for draft mode. When enabled: (1) Query operations (`find`, `findByID`) with `draft: true` will type required fields as optional, since validation is skipped for drafts. (2) The `draft` property is forbidden for collections without drafts in create operations. (3) Create operations enforce proper data requirements via discriminated unions. Defaults to `false`. **This will become the default behavior in v4.0.**|
140
140
141
141
## Config Location
@@ -277,6 +277,80 @@ Payload localization works on a field-by-field basis. As you can nest fields wit
277
277
278
278
By default, Payload will remove the `localized: true` property from sub-fields if a parent field is localized. Set this compatibility flag to `true` only if you have an existing Payload MongoDB database from pre-3.0, and you have nested localized fields that you would like to maintain without migrating.
279
279
280
+
## Logger
281
+
282
+
Payload uses [Pino](https://getpino.io) as its logger. By default, Payload logs pretty-printed output to stdout. You can customise this through the `logger` option in your config.
283
+
284
+
The `logger` option accepts one of three forms:
285
+
286
+
### 1. Logger options with an optional destination stream
287
+
288
+
Pass a `{ options, destination? }` object to configure the logger. `options` accepts standard [Pino logger options](https://getpino.io/#/docs/api?id=options) such as `level` and `name`. An optional `destination` stream can be supplied as a second argument.
289
+
290
+
```ts
291
+
import { buildConfig } from'payload'
292
+
293
+
exportdefaultbuildConfig({
294
+
// highlight-start
295
+
logger: {
296
+
options: {
297
+
level: 'debug',
298
+
},
299
+
},
300
+
// highlight-end
301
+
})
302
+
```
303
+
304
+
To write logs to a file, pass a destination stream:
**Compatibility note:** The `transport` property of Pino's `LoggerOptions` may
322
+
fail with `"unable to determine transport target"` in some environments. Pino
323
+
transports spawn a worker thread with their own module resolution, which can
324
+
break when modules are bundled or the project uses ESM. If you encounter this
325
+
error, use a pre-instantiated logger instead (see below).
326
+
</Banner>
327
+
328
+
### 2. Pre-instantiated logger
329
+
330
+
Pass a fully configured Pino logger instance. This is the recommended approach when you need custom transports, formatters, or `pino-pretty` in development:
0 commit comments