Koen
01/06/2025, 2:15 PMlogging: {
"markup": true
}
When I try to use markup in the log, the markup is not applied and it shows up as [green]logger[/]. What am I doing wrong?
task_run_logger.info(f"another [green]logger[/] logged this")
Marvin
01/06/2025, 2:16 PMPREFECT_LOGGING_MARKUP=True
, which should enable Rich's markup in Prefect logs. However, if the markup is not being applied, there might be some nuances to consider:
1. Markup Interpretation: Prefect's logging might not interpret the markup correctly if there are issues with the logger configuration or how it's being applied in the code. Ensure that your logger is configured to process markup.
2. Loggers Configuration: Prefect may not capture log statements from libraries that your flows and tasks use by default. You can specify additional loggers to include using the PREFECT_LOGGING_EXTRA_LOGGERS
setting. This can be done by setting the environment variable or in a profile.
3. Potential Misinterpretation: Strings containing square brackets might be inaccurately interpreted, leading to incomplete output. Ensure that the markup syntax is correctly formatted and not conflicting with other parts of your code.
For more details, you can refer to Prefect's logging documentation: Prefect Logging Documentation and Settings Reference.
If these suggestions don't resolve the issue, reviewing your logger configuration or checking for any conflicting settings might help.Koen
01/06/2025, 2:20 PMtask_run_logger = get_run_logger()
Koen
01/06/2025, 2:22 PMKoen
01/06/2025, 2:30 PMJake Kaplan
01/06/2025, 4:15 PM<http://logger.info|logger.info>(f"Hello flow,\u001b[32mThis text will be green\u001b")
it should workKoen
01/07/2025, 9:01 AM