PHP code example of norsys / logs-bundle

1. Go to this page and download the library: Download norsys/logs-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

norsys / logs-bundle example snippets



// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),
            new Norsys\LogsBundle\NorsysLogsBundle(),
            // ...
        );
        // ...
    }
    // ...
}

# app/config/config.yml

norsys_logs:
    doctrine:
        connection:
            driver:      pdo_sqlite
            driverClass: ~
            pdo:         ~
            dbname:      monolog
            host:        localhost
            port:        ~
            user:        root
            password:    ~
            charset:     UTF8
            path:        %kernel.root_dir%/db/monolog.db # The filesystem path to the database file for SQLite
            memory:      ~                               # True if the SQLite database should be in-memory (non-persistent)
            unix_socket: ~                               # The unix socket to use for MySQL


# src/AppBundle/Acme/Demo.php
namespace AppBundle\Acme;

// ...
use Norsys\LogsBundle\LoggerBehaviorTrait;

class Demo
{
    // ...
    use LoggerBehaviorTrait;
    // ...
}


# src/AppBundle/Acme/Demo.php
namespace AppBundle\Acme;

// ...
use Norsys\LogsBundle\LoggerBehaviorTrait;

class Demo
{
    // ...
    use LoggerBehaviorTrait;
    // ...

    public function doSomething()
    {
        $this->getLogger()->debug('Method AppBundle\Acme::doSomething() was called');
        // ...
    }
}