Skip to content

Commit c323315

Browse files
committed
Use antsibull-core's logging compatibility layer.
1 parent 0e70106 commit c323315

33 files changed

+71
-64
lines changed

.github/workflows/antsibull-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- '3.14'
3434
antsibull_core_ref:
3535
- main
36-
- '3.4.0'
36+
- '3.5.0'
3737
antsibull_docs_parser_ref:
3838
- main
3939
antsibull_changelog_ref:
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
minor_changes:
2+
- "Uses new logging framework provided by antsibull-core. This currently has no user-observable impact, but that will change with later versions of antsibull-core
3+
(https://github.com/ansible-community/antsibull-docs/pull/414)."
4+
- "antsibull-docs now depends on antsibull-core 3.5.0+ (https://github.com/ansible-community/antsibull-docs/pull/414)."

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ requires-python = ">=3.9"
2929
dependencies = [
3030
"ansible-pygments",
3131
"antsibull-changelog >= 0.24.0",
32-
"antsibull-core >= 3.4.0, < 4.0.0",
32+
"antsibull-core >= 3.5.0, < 4.0.0",
3333
"antsibull-docs-parser >= 1.1.0, < 2.0.0",
3434
"antsibull-docutils >= 1.3.0, < 2.0.0",
3535
"antsibull-fileutils >= 1.3.0, < 2.0.0",

src/antsibull_docs/ansible_output/load.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from pathlib import Path
1414

1515
import pydantic
16-
from antsibull_core.logging import log
16+
from antsibull_core.logging import get_module_logger
1717
from antsibull_core.pydantic import get_formatted_error_messages
1818
from antsibull_docutils.rst_code_finder import (
1919
CodeBlockInfo,
@@ -40,7 +40,7 @@
4040

4141
from ..schemas.collection_config import AnsibleOutputConfig, CollectionConfig
4242

43-
mlog = log.fields(mod=__name__)
43+
mlog = get_module_logger(__name__)
4444

4545

4646
@dataclass

src/antsibull_docs/ansible_output/process.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from pathlib import Path
1414

1515
import jinja2
16-
from antsibull_core.logging import log
16+
from antsibull_core.logging import get_module_logger
1717
from antsibull_docutils.rst_code_finder import (
1818
CodeBlockInfo,
1919
)
@@ -31,7 +31,7 @@
3131

3232
from .load import Block, Error
3333

34-
mlog = log.fields(mod=__name__)
34+
mlog = get_module_logger(__name__)
3535

3636

3737
def _get_variable_value(

src/antsibull_docs/ansible_output/replace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
import typing as t
1313
from pathlib import Path
1414

15-
from antsibull_core.logging import log
15+
from antsibull_core.logging import get_module_logger
1616
from antsibull_docutils.rst_code_finder import (
1717
CodeBlockInfo,
1818
)
1919

2020
from .load import Error
2121
from .process import Replacement
2222

23-
mlog = log.fields(mod=__name__)
23+
mlog = get_module_logger(__name__)
2424

2525

2626
_COLORS = {

src/antsibull_docs/cli/antsibull_docs.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@
2727
except ImportError:
2828
HAS_ARGCOMPLETE = False
2929

30-
import twiggy # type: ignore[import]
31-
from antsibull_core.logging import initialize_app_logging, log
30+
from antsibull_core.logging import (
31+
configure_logger,
32+
get_module_logger,
33+
initialize_app_logging,
34+
)
3235

3336
initialize_app_logging()
3437

@@ -58,7 +61,7 @@
5861
# pylint: enable=wrong-import-position
5962

6063

61-
mlog = log.fields(mod=__name__)
64+
mlog = get_module_logger(__name__)
6265

6366

6467
def _create_loader(module: str, function: str) -> Callable[[], Callable[[], int]]:
@@ -949,7 +952,7 @@ def run(args: list[str]) -> int:
949952
args=parsed_args, cfg=cfg, app_context_model=DocsAppContext
950953
)
951954
with app_context.app_and_lib_context(context_data) as (app_ctx, dummy_):
952-
twiggy.dict_config(app_ctx.logging_cfg.model_dump())
955+
configure_logger(app_ctx)
953956
flog.debug("Set logging config")
954957

955958
flog.fields(command=parsed_args.command).info("Action")

src/antsibull_docs/cli/doc_commands/_build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import typing as t
1515
from collections.abc import Mapping, MutableMapping
1616

17-
from antsibull_core.logging import log
17+
from antsibull_core.logging import get_module_logger
1818
from antsibull_core.schemas.collection_meta import (
1919
CollectionMetadata,
2020
CollectionsMetadata,
@@ -74,7 +74,7 @@
7474
from ...write_docs.plugin_stubs import output_all_plugin_stub_rst
7575
from ...write_docs.plugins import output_all_plugin_rst
7676

77-
mlog = log.fields(mod=__name__)
77+
mlog = get_module_logger(__name__)
7878

7979

8080
def _remove_collections_from_mapping(

src/antsibull_docs/cli/doc_commands/ansible_output.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from pathlib import Path
1414

1515
import pydantic
16-
from antsibull_core.logging import log
16+
from antsibull_core.logging import get_module_logger
1717
from antsibull_core.pydantic import get_formatted_error_messages
1818
from antsibull_fileutils.yaml import load_yaml_file
1919

@@ -37,7 +37,7 @@
3737
from ...schemas.collection_config import AnsibleOutputConfig
3838
from ...utils.collection_copier import CollectionCopier
3939

40-
mlog = log.fields(mod=__name__)
40+
mlog = get_module_logger(__name__)
4141

4242

4343
def find_blocks_in_file(

src/antsibull_docs/cli/doc_commands/collection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
import asyncio_pool # type: ignore[import]
1717
from antsibull_core.collections import install_together
1818
from antsibull_core.galaxy import CollectionDownloader, GalaxyContext
19-
from antsibull_core.logging import log
19+
from antsibull_core.logging import get_module_logger
2020
from antsibull_core.venv import FakeVenvRunner
2121
from antsibull_fileutils.tempfile import AnsibleTemporaryDirectory
2222

2323
from ... import app_context
2424
from ...jinja2.environment import OutputFormat
2525
from ._build import generate_docs_for_all_collections
2626

27-
mlog = log.fields(mod=__name__)
27+
mlog = get_module_logger(__name__)
2828

2929

3030
def generate_collection_docs(

0 commit comments

Comments
 (0)