Skip to content

Commit 618afc9

Browse files
committed
FIX: Subtype
1 parent ab67a5e commit 618afc9

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

plotly/io/_sg_scraper.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,15 @@ def _start_export_server():
170170
_export_server_state = "running"
171171

172172

173-
def _warn(msg, *args):
173+
def _warn(subtype, msg, *args):
174174
"""Log a warning, through Sphinx if possible so that builds can suppress
175-
it with ``suppress_warnings = ["plotly.sg_scraper"]``."""
175+
it with ``suppress_warnings = ["plotly.<subtype>"]``."""
176176
try:
177177
from sphinx.util.logging import getLogger
178178
except Exception:
179179
logging.getLogger(__name__).warning(msg, *args)
180180
else:
181-
getLogger(__name__).warning(msg, *args, type="plotly", subtype="sg_scraper")
181+
getLogger(__name__).warning(msg, *args, type="plotly", subtype=subtype)
182182

183183

184184
def _abandon_export_server(exc):
@@ -187,7 +187,9 @@ def _abandon_export_server(exc):
187187
if _export_server_state != "running":
188188
return False
189189
_export_server_state = "disabled"
190+
# Recovered from, so separately suppressible from the warning below
190191
_warn(
192+
"sg_scraper_fallback",
191193
"The shared plotly static image export browser failed with '%s: %s'; "
192194
"falling back to one browser per exported figure.",
193195
type(exc).__name__,
@@ -214,6 +216,7 @@ def _static_export_available():
214216
_export_image({"data": []}, None, "png")
215217
except Exception as exc:
216218
_warn(
219+
"sg_scraper",
217220
"plotly static image export is unavailable, so example "
218221
"thumbnails will fall back to a placeholder image. Static "
219222
"export requires Kaleido and a Chromium-based browser "

0 commit comments

Comments
 (0)