title: Monolog implementation with common class
body: <p>I succeeded in implementing a Monolog logger for test purposes. And now I'm trying to use it in a project. This project doesn't use any MVC framework. </p>
  
  <p>I'm trying to write a common class file to wrap access to the Monolog instance.   </p>
  
  <p>Common class file: File: app_log.php</p>
  
  <pre><code>require 'autoload.php';
  use Monolog\Logger;
  use Monolog\Handler\RotatingFileHandler;
  use Monolog\Processor\UidProcessor;
  use Monolog\Processor\WebProcessor;
  use Monolog\Processor\MemoryUsageProcessor;
  use Monolog\Processor\ProcessIdProcessor;
  use Monolog\Formatter\LineFormatter;
  
  class app_log {
    public function info(){
      $logger = new Logger('applog');
      $handler = new RotatingFileHandler('useractivity.log', 0, Logger::INFO);
      $handler-&gt;setFormatter(new LineFormatter("[%datetime%] %extra.process_id% %channel%.%level_name%: %message% %extra% %context% \n"));
      $logger-&gt;pushHandler($handler);
      $logger-&gt;pushProcessor(new WebProcessor);
    }  
  }
  </code></pre>
  
  <p>Other File: users.php</p>
  
  <pre><code>include_once 'app_log.php';
  class users extends dbconnector{
      function login(){
        // Some project code. 
        $logger = new app_log();
        $logger-&gt;info('User logged successfully');
      }
  }
  </code></pre>
  
  <p>Up to this works well and i want to include filename, method name,  request parameters. But i am getting <code>app_log.php</code> file name instead <code>users.php</code> and Method name is <code>'info'</code> instead <code>'login'</code> in the logs. </p>
  
  <p>Example: </p>
  
  <pre><code>[2018-06-07 20:55:50] 4410 applog.INFO: User logged successfully {"file":"/var/www/portal/lib/app_log.php","line":59,"class":"app_log","function":"info"} []
  </code></pre>
  
  <p>Could you guys help on this part? </p>