hi guys, how do i define a user friendly logging t...
# prefect-community
s
hi guys, how do i define a user friendly logging task? without making the user define a separate task just to concatenate strings?
Copy code
@prefect.task
def log(item):
	<http://prefect.context.logger.info|prefect.context.logger.info>(item)
this works when you pass in the string output of an upstream task as the entirety of the input to the logging task
Copy code
log(output)
but what if i want to do something like
Copy code
log("the output of the previous task was: " + output)
here we have an issue because
+
is not a task and so we will actually be logging something like
Copy code
the output of the previous task was: Task<blah blah>
k
Hey @sark, You may be better off using an f-string in your log task:
Copy code
@prefect.task
def log(item):
	<http://prefect.context.logger.info|prefect.context.logger.info>(f"Previous Task Output was: {item}")