Skip to content

Commit 4b38cde

Browse files
Refine documentation and revert styling guide
This commit applies several targeted adjustments to the documentation based on user feedback: - Styling Guide: Rolled back the recent addition of the styling guide. - `docs/styling_guide.md` is not included. - References in `docs/contributing.md` and `mkdocs.yml` removed. - `docs/contributing.md` retains earlier improvements regarding Black/Pylint mentions and `grip` usage. - `docs/cookbook.md`: - Reverted the section heading concerning logging configuration back to "Using `fileConfig`" and adjusted its description. - `docs/index.md`: - Ensured heading levels are consistent with the original structure. - Removed a specific clarifying comment from a code example. - `docs/quickstart.md`: - Uncommented an example line related to default logging fields. - `mkdocs.yml`: - Restored the `literate-nav` plugin configuration to its previous state. These changes fine-tune the documentation improvements and remove the recently added styling guide components.
1 parent 012f28c commit 4b38cde

5 files changed

Lines changed: 6 additions & 13 deletions

File tree

docs/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The following are things that can be worked on without an existing issue:
2525

2626
### 2. Fork the repository and make your changes
2727

28-
Code style is enforced using `black` for formatting, `pylint` for linting, and `mypy` for type checking. Please ensure your changes pass these checks. For a summary of the main conventions, see the [Styling Guide](styling_guide.md). Otherwise, try to match existing code. This includes the use of "headings" and "dividers" (this will make sense when you look at the code).
28+
While there isn't extensive styling documentation, code style is enforced using `black` for formatting and `pylint` for linting (details below). Please ensure your changes pass these checks. Otherwise, try to match existing code. This includes the use of "headings" and "dividers" (this will make sense when you look at the code).
2929

3030
All devlopment tooling can be installed (usually into a virtual environment), using the `dev` optional dependency:
3131

docs/cookbook.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,9 @@ def main_3():
137137
main_3()
138138
```
139139

140-
## Using Dictionary-based Configuration (e.g., from YAML)
140+
## Using `fileConfig`
141141

142-
While Python's [`logging.config.fileConfig`](https://docs.python.org/3/library/logging.config.html#logging.config.fileConfig) is designed for INI-style configuration files, [`logging.config.dictConfig`](https://docs.python.org/3/library/logging.config.html#logging.config.dictConfig) is used for dictionary-based configurations, often loaded from YAML or JSON files.
143-
144-
To use `python-json-logger` with such a configuration, you specify the formatter class (e.g., `pythonjsonlogger.json.JsonFormatter`) in your dictionary. Here is a sample configuration loaded from a YAML file:
142+
To use the module with a yaml config file using the [`fileConfig` function](https://docs.python.org/3/library/logging.config.html#logging.config.fileConfig), use the class `pythonjsonlogger.json.JsonFormatter`. Here is a sample config file:
145143

146144
```yaml title="example_config.yaml"
147145
version: 1

docs/index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ logger = logging.getLogger()
3737
logger.setLevel(logging.INFO)
3838

3939
handler = logging.StreamHandler()
40-
# Note: The JsonFormatter class is available from pythonjsonlogger.json,
41-
# pythonjsonlogger.orjson, and pythonjsonlogger.msgspec
4240
handler.setFormatter(JsonFormatter())
4341

4442
logger.addHandler(handler)

docs/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ formatter = JsonFormatter(
8989
defaults={"environment": "dev"}
9090
)
9191
# ...
92-
# logger.info("this message will have environment=dev by default")
92+
logger.info("this message will have environment=dev by default")
9393
logger.info("this overwrites the environment field", extra={"environment": "prod"})
9494
```
9595

mkdocs.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ nav:
1616
- changelog.md
1717
- security.md
1818
- contributing.md
19-
- styling_guide.md
2019
- API Reference:
2120
- ... | reference/pythonjsonlogger/*
2221

@@ -108,10 +107,8 @@ plugins:
108107
unwrap_annotated: true
109108
show_source: false
110109
docstring_section_style: spacy
111-
# literate-nav was configured with a missing SUMMARY.txt and might be redundant
112-
# due to the explicit nav structure and awesome-pages.
113-
# - literate-nav:
114-
# nav_file: SUMMARY.txt
110+
- literate-nav:
111+
nav_file: SUMMARY.txt
115112
- mike:
116113
canonical_version: latest
117114

0 commit comments

Comments
 (0)