Skip to content

Commit 7ce3825

Browse files
Al3xDoBordacarmocca
authored
Adding hint to the logger's error messages (#16034)
Co-authored-by: Jirka Borovec <[email protected]> Co-authored-by: Carlos Mocholí <[email protected]> Fixes #15143
1 parent a58639c commit 7ce3825

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/pytorch_lightning/trainer/connectors/logger_connector/fx_validator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ def check_logging(cls, fx_name: str) -> None:
174174
)
175175

176176
if cls.functions[fx_name] is None:
177-
raise MisconfigurationException(f"You can't `self.log()` inside `{fx_name}`.")
177+
raise MisconfigurationException(
178+
f"You can't `self.log()` inside `{fx_name}`. HINT: You can still log directly to the logger by using"
179+
" `self.logger.experiment`."
180+
)
178181

179182
@classmethod
180183
def get_default_logging_levels(

0 commit comments

Comments
 (0)