Skip to content
Draft
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
10 changes: 6 additions & 4 deletions .github/workflows/antsibull-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ jobs:
- name: Check out dependent project antsibull-core
uses: actions/checkout@v5
with:
repository: ansible-community/antsibull-core
repository: felixfontein/antsibull-core
ref: logging
path: antsibull-core
ref: ${{ matrix.antsibull_core_ref }}
persist-credentials: false

- name: Check out dependent project antsibull-docs-parser
Expand Down Expand Up @@ -196,7 +196,8 @@ jobs:
- name: Check out dependent project antsibull-core
uses: actions/checkout@v5
with:
repository: ansible-community/antsibull-core
repository: felixfontein/antsibull-core
ref: logging
path: antsibull-core
persist-credentials: false

Expand Down Expand Up @@ -281,7 +282,8 @@ jobs:
- name: Check out dependent project antsibull-core
uses: actions/checkout@v5
with:
repository: ansible-community/antsibull-core
repository: felixfontein/antsibull-core
ref: logging
path: antsibull-core
persist-credentials: false

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/nox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ jobs:
- name: Check out dependent project antsibull-core
uses: actions/checkout@v5
with:
repository: ansible-community/antsibull-core
repository: felixfontein/antsibull-core
ref: logging
path: antsibull-core
persist-credentials: false
- name: Check out dependent project antsibull-docs-parser
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/ansible_output/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pathlib import Path

import pydantic
from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger
from antsibull_core.pydantic import get_formatted_error_messages
from antsibull_docutils.rst_code_finder import (
CodeBlockInfo,
Expand All @@ -40,7 +40,7 @@

from ..schemas.collection_config import AnsibleOutputConfig, CollectionConfig

mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


@dataclass
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/ansible_output/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pathlib import Path

import jinja2
from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger
from antsibull_docutils.rst_code_finder import (
CodeBlockInfo,
)
Expand All @@ -31,7 +31,7 @@

from .load import Block, Error

mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


def _get_variable_value(
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/ansible_output/replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
import typing as t
from pathlib import Path

from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger
from antsibull_docutils.rst_code_finder import (
CodeBlockInfo,
)

from .load import Error
from .process import Replacement

mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


_COLORS = {
Expand Down
11 changes: 7 additions & 4 deletions src/antsibull_docs/cli/antsibull_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@
except ImportError:
HAS_ARGCOMPLETE = False

import twiggy # type: ignore[import]
from antsibull_core.logging import initialize_app_logging, log
from antsibull_core.logging import (
configure_logger,
get_module_logger,
initialize_app_logging,
)

initialize_app_logging()

Expand Down Expand Up @@ -58,7 +61,7 @@
# pylint: enable=wrong-import-position


mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


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

flog.fields(command=parsed_args.command).info("Action")
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/cli/doc_commands/_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import typing as t
from collections.abc import Mapping, MutableMapping

from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger
from antsibull_core.schemas.collection_meta import (
CollectionMetadata,
CollectionsMetadata,
Expand Down Expand Up @@ -74,7 +74,7 @@
from ...write_docs.plugin_stubs import output_all_plugin_stub_rst
from ...write_docs.plugins import output_all_plugin_rst

mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


def _remove_collections_from_mapping(
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/cli/doc_commands/ansible_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pathlib import Path

import pydantic
from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger
from antsibull_core.pydantic import get_formatted_error_messages
from antsibull_fileutils.yaml import load_yaml_file

Expand All @@ -37,7 +37,7 @@
from ...schemas.collection_config import AnsibleOutputConfig
from ...utils.collection_copier import CollectionCopier

mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


def find_blocks_in_file(
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/cli/doc_commands/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
import asyncio_pool # type: ignore[import]
from antsibull_core.collections import install_together
from antsibull_core.galaxy import CollectionDownloader, GalaxyContext
from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger
from antsibull_core.venv import FakeVenvRunner
from antsibull_fileutils.tempfile import AnsibleTemporaryDirectory

from ... import app_context
from ...jinja2.environment import OutputFormat
from ._build import generate_docs_for_all_collections

mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


def generate_collection_docs(
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/cli/doc_commands/collection_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import os.path

from antsibull_core.collections import install_together
from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger
from antsibull_core.venv import FakeVenvRunner
from antsibull_fileutils.tempfile import AnsibleTemporaryDirectory

Expand All @@ -21,7 +21,7 @@
from ._build import generate_docs_for_all_collections
from .collection import retrieve

mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


def generate_collection_plugins_docs(
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/cli/doc_commands/current.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

from __future__ import annotations

from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger
from antsibull_core.venv import FakeVenvRunner

from ... import app_context
from ...jinja2.environment import OutputFormat
from ._build import generate_docs_for_all_collections

mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


def generate_docs() -> int:
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/cli/doc_commands/devel.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from antsibull_core.collections import install_together
from antsibull_core.dependency_files import parse_pieces_file
from antsibull_core.galaxy import CollectionDownloader, DownloadResults, GalaxyContext
from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger
from antsibull_core.schemas.collection_meta import CollectionsMetadata
from antsibull_core.venv import FakeVenvRunner, VenvRunner
from antsibull_fileutils.tempfile import AnsibleTemporaryDirectory
Expand All @@ -27,7 +27,7 @@
from ...jinja2.environment import OutputFormat
from ._build import generate_docs_for_all_collections

mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


async def retrieve(
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/cli/doc_commands/lint_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import os
import textwrap

from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger

from ... import app_context
from ...collection_config import lint_collection_config
Expand All @@ -33,7 +33,7 @@
collect_names,
)

mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


def lint_collection_docs() -> int:
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/cli/doc_commands/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import sys
import traceback

from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger
from antsibull_core.subprocess_util import CalledProcessError
from antsibull_core.vendored.json_utils import _filter_non_json_lines
from antsibull_core.venv import FakeVenvRunner
Expand All @@ -34,7 +34,7 @@
from ...write_docs.io import Output
from ...write_docs.plugins import write_plugin_rst

mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


def generate_plugin_docs(
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/cli/doc_commands/sphinx_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
import sys
import typing as t

from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger

import antsibull_docs

from ... import app_context
from ...jinja2.environment import doc_environment
from ...utils.text import sanitize_whitespace

mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


RST_INDEX_RST = "rst/index.rst"
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/cli/doc_commands/stable.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from antsibull_core.collections import install_together
from antsibull_core.dependency_files import DepsFile
from antsibull_core.galaxy import CollectionDownloader, GalaxyContext
from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger
from antsibull_core.schemas.collection_meta import CollectionsMetadata
from antsibull_core.venv import FakeVenvRunner, VenvRunner
from antsibull_fileutils.tempfile import AnsibleTemporaryDirectory
Expand All @@ -28,7 +28,7 @@
from ...jinja2.environment import OutputFormat
from ._build import generate_docs_for_all_collections

mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


async def retrieve(
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/collection_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
import asyncio_pool # type: ignore[import]
import pydantic as p
from antsibull_core import app_context
from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger
from antsibull_core.pydantic import forbid_extras, get_formatted_error_messages
from antsibull_fileutils.yaml import load_yaml_file

from .schemas.collection_config import CollectionConfig

mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


_ANSIBLE_CORE_CONFIG: dict[str, t.Any] = {}
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/collection_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import asyncio_pool # type: ignore[import]
import pydantic as p
from antsibull_core import app_context
from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger
from antsibull_core.pydantic import forbid_extras, get_formatted_error_messages
from antsibull_fileutils.yaml import load_yaml_file

Expand All @@ -29,7 +29,7 @@
MatrixRoom,
)

mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


_ANSIBLE_CORE_METADATA = {
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/docs_parsing/ansible_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import typing as t
from collections.abc import Mapping

from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger
from antsibull_core.subprocess_util import CalledProcessError
from antsibull_core.vendored.json_utils import _filter_non_json_lines
from packaging.version import Version as PypiVer
Expand All @@ -27,7 +27,7 @@
from antsibull_core.venv import FakeVenvRunner, VenvRunner


mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


def _extract_ansible_builtin_metadata(stdout: str) -> AnsibleCollectionMetadata:
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/docs_parsing/ansible_doc_core_213.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from collections.abc import Mapping, MutableMapping

import semantic_version as semver
from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger
from antsibull_core.subprocess_util import CalledProcessError
from antsibull_core.vendored.json_utils import _filter_non_json_lines
from packaging.version import Version as PypiVer
Expand All @@ -28,7 +28,7 @@
from antsibull_core.venv import FakeVenvRunner, VenvRunner


mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


async def _call_ansible_doc(
Expand Down
4 changes: 2 additions & 2 deletions src/antsibull_docs/docs_parsing/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import typing as t
from collections.abc import Mapping, MutableMapping

from antsibull_core.logging import log
from antsibull_core.logging import get_module_logger
from packaging.version import Version as PypiVer

from .. import app_context
Expand All @@ -24,7 +24,7 @@
from antsibull_core.venv import FakeVenvRunner, VenvRunner


mlog = log.fields(mod=__name__)
mlog = get_module_logger(__name__)


async def get_ansible_plugin_info(
Expand Down
Loading