My log
2017-11-25T00:18:11+00:00 DEBUG (7): Test service debug log message!
2017-11-25T00:18:11+00:00 DEBUG (7): Test service debug log message paramOne paramTwo!
2017-11-25T00:18:11+00:00 WARN (4): Test service warning log message!
2017-11-25T00:18:11+00:00 WARN (4): Test service warning log message paramOne paramTwo!
Application log
2017-11-25T00:18:11+00:00 INFO (6): Event bootstrap
2017-11-25T00:18:11+00:00 INFO (6): Event configure
2017-11-25T00:18:11+00:00 INFO (6): Configuring application
2017-11-25T00:18:11+00:00 INFO (6): Attaching aggregate listener [object WebinoAppLib\Listener\DebuggerListener]
2017-11-25T00:18:11+00:00 INFO (6): Attaching aggregate listener [object WebinoAppLib\Listener\ContextListener]
2017-11-25T00:18:11+00:00 INFO (6): Event bootstrap
2017-11-25T00:18:11+00:00 INFO (6): Matching context WebinoAppLib\Context\HttpContext
2017-11-25T00:18:11+00:00 INFO (6): Attaching aggregate listener [object WebinoAppLib\Listener\Http\HttpRoutingListener]
2017-11-25T00:18:11+00:00 INFO (6): Attaching aggregate listener [object WebinoAppLib\Listener\Http\HttpRequestListener]
2017-11-25T00:18:11+00:00 INFO (6): Attaching aggregate listener [object WebinoAppLib\Listener\Http\HttpResponseListener]
2017-11-25T00:18:11+00:00 INFO (6): Event WebinoAppLib\Event\ContextEvent
2017-11-25T00:18:11+00:00 INFO (6): Attaching [object Closure] to an event WebinoAppLib\Router\DefaultRoute with priority 1
2017-11-25T00:18:11+00:00 INFO (6): Event dispatch
2017-11-25T00:18:11+00:00 INFO (6): Attaching [object Closure] to an event routeMatch with priority 1
2017-11-25T00:18:11+00:00 INFO (6): Event routeMatch
2017-11-25T00:18:11+00:00 INFO (6): Event WebinoAppLib\Router\DefaultRoute
Source Preview
<?php
/**
 * Logger Aware Custom
 * Webino Example
 */

use WebinoAppLib\Event\RouteEvent;
use 
WebinoAppLib\Factory\AbstractFactory;
use 
WebinoAppLib\Feature\Service;
use 
WebinoAppLib\Response\Content\SourcePreview;
use 
WebinoAppLib\Router\DefaultRoute;
use 
WebinoExamplesLib\Html\FieldSetScrollBox;
use 
WebinoHtmlLib\Html;
use 
WebinoExamplesLib\Html\ScrollBox;
use 
WebinoConfigLib\Feature\Log;
use 
WebinoConfigLib\Feature\Logger;
use 
WebinoLogLib\LoggerAwareInterface;
use 
WebinoLogLib\LoggerAwareTrait;
use 
WebinoLogLib\Message\AbstractWarningMessage;
use 
Zend\Stdlib\Parameters;

require 
__DIR__ '/../../vendor/autoload.php';

/**
 * Example loggers
 */
class MyLogger extends Logger
{
    const 
NAME 'myLogger';
}


/**
 * Example logs
 */
abstract class MyLogs
{
    const 
APP 'app.log';
    const 
MY 'my.log';
}

/**
 * Custom log message
 */
class MyLogMessage extends AbstractWarningMessage
{
    public function 
getMessage(Parameters $args)
    {
        return 
count($args) ? 'Test service warning log message {0} {1}!' 'Test service warning log message!';
    }
}

/**
 * Custom logger aware
 */
class MyService implements LoggerAwareInterface
{
    use 
LoggerAwareTrait;

    public function 
doSomething()
    {
        
/**
         * Logging PSR-3
         * style.
         */
        
$this->getLogger()->log()->debug('Test service debug log message!');

        
/**
         * Logging PSR-3 style
         * with arguments.
         */
        
$this->getLogger()->log()->debug('Test service debug log message {0} {1}!', ['paramOne''paramTwo']);
    }

    public function 
doSomethingDifferent()
    {
        
/**
         * Logging message
         * class.
         */
        
$this->getLogger()->log(MyLogMessage::class);

        
/**
         * Logging message class
         * with arguments.
         */
        
$this->getLogger()->log(MyLogMessage::class, ['paramOne''paramTwo']);
    }
}

/**
 * Custom service factory
 */
class MyServiceFactory extends AbstractFactory
{
    protected function 
create()
    {
        
$myService = new MyService;

        
/**
         * Injecting logger
         * into custom service.
         */
        
$myService->setLogger($this->getApp()->getLogger(MyLogger::NAME));

        return 
$myService;
    }
}

$config Webino::config([
    
/**
     * Configuring app
     * log file.
     */
    
new Log(MyLogs::APP),

    
/**
     * Configuring custom
     * log file.
     */
    
new MyLogger([
        new 
Log(MyLogs::MY),
    ]),

    
/**
     * Configuring custom
     * service factory.
     */
    
new Service(MyService::class, MyServiceFactory::class),
]);

$app Webino::application($config)->bootstrap();

$app->bind(DefaultRoute::class, function (RouteEvent $event) {
    
/** @var MyService $myService */
    
$myService $event->getApp()->get(MyService::class);

    
/**
     * Calling custom
     * service methods.
     */
    
$myService->doSomething();
    
$myService->doSomethingDifferent();

    
/**
     * Obtaining custom
     * log file contents.
     */
    
$myLog $event->getApp()->file()->read(MyLogs::MY);

    
/**
     * Obtaining log
     * file contents.
     */
    
$log $event->getApp()->file()->read(MyLogs::APP);

    
$event->setResponse([
        new 
FieldSetScrollBox('My log'$myLog),
        new 
FieldSetScrollBox('Application log'$log),
        new 
SourcePreview(__FILE__),
    ]);
});

$app->dispatch();