Use a signal's connect method to connect a function to a signal. When a signal is sent, each connected function is called with the sender and any named arguments the signal provides.
from flask import template_rendered
def log_template(sender, template, context, **kwargs):
sender.logger.in...