Dima Anoshin07/06/2023, 2:22 PM
when we have a flow and we want to add logs, should logs be another flow or task?
def log_it(): logger = get_run_logger() <http://logger.info|logger.info>("INFO level log message.") logger.debug("You only see this message if the logging level is set to DEBUG. 🙂")
Emil Christensen07/06/2023, 2:24 PM
. They do not have to be separated out.
or inside a function it calls, you can log from there.
Dima Anoshin07/06/2023, 2:30 PM
@task(retries=4, retry_delay_seconds=0.1) def save_weather(temp, windspeed, rain): logger = get_run_logger() <http://logger.info|logger.info>("Saving weather data...") with open("weather.csv", "w+") as w: w.write(str(temp) + ", " + str(windspeed) + ", " + str(rain) + "\n") <http://logger.info|logger.info>("Weather data saved successfully.") return "Successfully wrote temp, windspeed, and rain"
Emil Christensen07/06/2023, 2:35 PM