Hi, in the documentation, we see that "dagster.get...
# ask-community
c
Hi, in the documentation, we see that "dagster.get_dagster_logger()" is a convenient alternative to "context.log.info" for most cases. What would be some situation where "context.log.info" cannot be replaced with "dagster.get_dagster_logger()", or the pros and cons of using each? Is there a recommended style that the Dagster community prefers? Documentation: https://docs.dagster.io/_apidocs/utilities#dagster.get_dagster_logger
dagster bot responded by community 1
🤖 1
z
I don't think it matters. I use
get_dagster_logger
when I'm a few function calls deep and don't have easy access to the context / don't want to pass a logger variable through multiple layers of functions, and I know that the code isn't going to be used outside the context of Dagster. But functionally they're the same, I think they just use the normal python
logging.getLogger
method to retrieve the same logging instance.
s
Zach is correct. The primary purpose of
get_dagster_logger
is to save users the trouble of threading
context
into subroutines called in a compute/materialize function.