is there a recommended method of providing `contex...
# ask-community
c
is there a recommended method of providing
context.log
access to a resource?
🤖 1
so far, I've provided the Op context as a param to a method, but wondering if there's a built-in way using the
@resource
decorator
o
Copy code
@resource(...)
def my_resource(context):
    return MyClass(..., logger=context.log)
should work!
you can also
from dagster import get_dagster_logger
, and inside the body of the resource call
get_dagster_logger().info("foo")
c
awesome, the first example is what I was looking for. wasn't sure if that worked
1
so that
context
param on the resource def is the same one that contains
config_schema
right?
o
the context object is of type InitResourceContext, so it'll have a
resource_config
property (this is the resolved config value)
the
config_schema
is the schema for that config blob, and will be inside the argument to the
@resource
decorator
c
gotcha, thanks for the reference