Skip to content

Commit

Permalink
docs: add recipe for stderr
Browse files Browse the repository at this point in the history
Fixes #551
  • Loading branch information
hynek committed Oct 9, 2023
1 parent 37f663e commit c172022
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,12 @@ def manager(request_id: str):
```

See the [issue 425](https://github.com/hynek/structlog/issues/425) for a more complete example.


## Switching Console Output to Standard Error

When using structlog without standard library integration and want the log output to go to standard error (*stderr*) instead of standard out (*stdout*), you can switch with a single line of configuration:

```python
structlog.configure(logger_factory=structlog.PrintLoggerFactory(sys.stderr))
```

0 comments on commit c172022

Please sign in to comment.