Logging in python models

The problem I’m having

I want to log some information in python models, e.g. for debugging.
I would like to have the same effect as with {% do log(‘some msg’, info=True) %}.

The context of why I’m trying to do this

I use dbt on Snowflake

What I’ve already tried

I have tried to do it with print, but I don’t see anything on my terminal, and in Snowflake.

Some example code or error messages

def model(dbt, session):
    # Must be either table or incremental (view is not currently supported)
    dbt.config(materialized="table")

    # DataFrame representing an upstream model
    df = dbt.ref("my_table_name")

    print(session._session_id)

    return df