55# ##################################
66
77# standard library
8- import logging
98from pathlib import Path
109from typing import Optional
1110
1211# 3rd party
1312from mkdocs .config .config_options import Config
13+ from mkdocs .plugins import get_plugin_logger
1414from mkdocs .structure .pages import Page
1515
16+ # package
17+ from mkdocs_rss_plugin .constants import MKDOCS_LOGGER_NAME
18+
1619# ############################################################################
1720# ########## Globals #############
1821# ################################
1922
20- logger = logging . getLogger ( "mkdocs.mkdocs_rss_plugin" )
23+ logger = get_plugin_logger ( MKDOCS_LOGGER_NAME )
2124
2225# ############################################################################
2326# ########## Logic ###############
@@ -58,7 +61,7 @@ def __init__(self, mkdocs_config: Config, switch_force: bool = True) -> None:
5861 if switch_force is False :
5962 self .IS_ENABLED = False
6063 logger .debug (
61- "[rss-plugin] Integration with Social Cards (Material theme) is "
64+ "Integration with Social Cards (Material theme) is "
6265 "disabled in plugin's option in Mkdocs configuration."
6366 )
6467
@@ -92,23 +95,21 @@ def is_social_plugin_enabled_mkdocs(self, mkdocs_config: Config) -> bool:
9295 bool: True if the theme material and the plugin social cards is enabled.
9396 """
9497 if not self .is_theme_material (mkdocs_config = mkdocs_config ):
95- logger .debug (
96- "[rss-plugin] Installed theme is not 'material'. Integration disabled."
97- )
98+ logger .debug ("Installed theme is not 'material'. Integration disabled." )
9899 return False
99100
100101 if not mkdocs_config .plugins .get ("material/social" ):
101- logger .debug ("[rss-plugin] Social plugin not listed in configuration." )
102+ logger .debug ("Social plugin not listed in configuration." )
102103 return False
103104
104105 social_plugin_cfg = mkdocs_config .plugins .get ("material/social" )
105106
106107 if not social_plugin_cfg .config .enabled :
107- logger .debug ("[rss-plugin] Social plugin is installed but disabled." )
108+ logger .debug ("Social plugin is installed but disabled." )
108109 self .IS_SOCIAL_PLUGIN_ENABLED = False
109110 return False
110111
111- logger .debug ("[rss-plugin] Social plugin is enabled in Mkdocs configuration." )
112+ logger .debug ("Social plugin is enabled in Mkdocs configuration." )
112113 self .IS_SOCIAL_PLUGIN_CARDS_ENABLED = True
113114 return True
114115
@@ -127,13 +128,11 @@ def is_social_plugin_and_cards_enabled_mkdocs(self, mkdocs_config: Config) -> bo
127128 social_plugin_cfg = mkdocs_config .plugins .get ("material/social" )
128129
129130 if not social_plugin_cfg .config .cards :
130- logger .debug (
131- "[rss-plugin] Social plugin is installed, present but cards are disabled."
132- )
131+ logger .debug ("Social plugin is installed, present but cards are disabled." )
133132 self .IS_SOCIAL_PLUGIN_CARDS_ENABLED = False
134133 return False
135134
136- logger .debug ("[rss-plugin] Social cards are enabled in Mkdocs configuration." )
135+ logger .debug ("Social cards are enabled in Mkdocs configuration." )
137136 self .IS_SOCIAL_PLUGIN_CARDS_ENABLED = True
138137 return True
139138
@@ -168,7 +167,7 @@ def get_social_cards_dir(self, mkdocs_config: Config) -> str:
168167 social_plugin_cfg = mkdocs_config .plugins .get ("material/social" )
169168
170169 logger .debug (
171- "[rss-plugin] Social cards folder in Mkdocs build directory: "
170+ "Social cards folder in Mkdocs build directory: "
172171 f"{ social_plugin_cfg .config .cards_dir } ."
173172 )
174173
0 commit comments