title: How can ruby logger set the progname automatically based on the method
body: <p>I have set up my logger using a module with the following (simplified) version:</p>
  
  <pre><code>module Logging
    class &lt;&lt; self
      def logger
      end
      def logger=(logger)
        @logger = logger
      end
    end
  end
  </code></pre>
  
  <p>I would like to do something like the following (it didn't work):</p>
  
  <p><a href="https://stackoverflow.com/questions/199527/get-the-name-of-the-currently-executing-method">Get the name of the currently executing method</a></p>
  
  <pre><code>def test_method 
    return __callee__
  end
  </code></pre>
  
  <p>This way without the above, add <code>logger.progname = self.test_method</code></p>
  
  <p>So it should look like this:</p>
  
  <pre><code>module Logging
    class &lt;&lt; self
      def logger
        return @logger if @logger
        @logger.progname = self.test_method
      end
      def logger=(logger)
        @logger = logger
      end
    end
  end
  </code></pre>
  
  <p>The end goal should be such that, with method "MyMethod":</p>
  
  <pre><code>def my_method
    logger.debug "hi"
  end
  </code></pre>
  
  <p>I get <code>=&gt; "my_method: "hi"</code></p>