How to properly code up a function call logging decorator?
<p>Consider the example:</p>

<p>debug.py:</p>

<pre><code>import logging

class log_funcname:

    def __init__(self, the_logger):
        self.the_logger = the_logger

    def __call__(self, fn):
        def simply_call(*args, **kwargs):
            self.the_logger.critical(fn.func_name)
            return fn(*args, **kwargs)
        return simply_call

logger = logging.getLogger()

formatter = logging.Formatter("%(lineno)s")
ch = logging.StreamHandler()
ch.setFormatter(formatter)
logger.addHandler(ch)

@log_funcname(logger)
def hello():
  pass

hello()
</code></pre>

<p>output:</p>

<pre><code>$ python debug.py
10
</code></pre>

<p>I meant to create a function that calls the logger, passing it the line number and file name from where the execution really happened. If I wanted the example app to ouput 25 instead of 10, what should I change then? </p>
