PHP code example of everon / logger-basic

1. Go to this page and download the library: Download everon/logger-basic 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/ */

    

everon / logger-basic example snippets


    'pluginClass' => \Everon\LoggerBasic\Plugin\ErrorLog\ErrorLogLoggerPlugin::class,
    'pluginFactoryClass' => NULL,
    'logLevel' => Level::Debug,
    'shouldBubble' => true,
    'messageType' => \Monolog\Handler\ErrorLogHandler::OPERATING_SYSTEM,
    'expandNewlines' => false,
    

    use Everon\Shared\Logger\Configurator\Plugin\LoggerConfigurator;
    use Everon\Shared\LoggerBasic\Configurator\Plugin\ErrorLogLoggerPluginConfigurator;
    use Everon\Logger\EveronLoggerFacade;
  
    $errorLogPluginConfigurator = (new ErrorLogLoggerPluginConfigurator)
        ->setLogLevel(Level::Info)
        ->setMessageType(\Monolog\Handler\ErrorLogHandler::OPERATING_SYSTEM)
        ->setExpandNewlines(false);
    
    $configurator = (new LoggerConfigurator)
        ->add($errorLogPluginConfigurator);
    
    $logger = (new EveronLoggerFacade())->buildLogger($configurator);
    
    $logger->info('lorem ipsum');
    

    'pluginClass' => \Everon\LoggerBasic\Plugin\Nullee\NulleeLoggerPlugin::class,
    'pluginFactoryClass' => NULL,
    'logLevel' => Level::Debug,
    'shouldBubble' => true,
    

    use Everon\Shared\Logger\Configurator\Plugin\LoggerConfigurator;
    use Everon\Shared\LoggerBasic\Configurator\Plugin\NulleeLoggerPluginConfigurator;
    use Everon\Logger\EveronLoggerFacade;
  
    $nulleePluginConfigurator = (new NulleeLoggerPluginConfigurator)
        ->setLogLevel(Level::Info);
    
    $configurator = (new LoggerConfigurator)
        ->add($nulleePluginConfigurator);
    
    $logger = (new EveronLoggerFacade())->buildLogger($configurator);
    
    $logger->info('lorem ipsum');
    

    'pluginClass' => \Everon\LoggerBasic\Plugin\Stream\StreamLoggerPlugin::class,
    'pluginFactoryClass' => NULL,
    'logLevel' => Level::Debug,
    'shouldBubble' => true,
    'streamLocation' => NULL,
    'filePermission' => NULL,
    'useLocking' => false,
    

    use Everon\Shared\Logger\Configurator\Plugin\LoggerConfigurator;
    use Everon\Shared\LoggerBasic\Configurator\Plugin\StreamLoggerPluginConfigurator; 
    use Everon\Logger\EveronLoggerFacade;
  
    $streamPluginConfigurator = (new StreamLoggerPluginConfigurator)
        ->setLogLevel(Level::Info)
        ->setStreamLocation('/tmp/debug.log');
    
    $configurator = (new LoggerConfigurator)
        ->add($streamPluginConfigurator);
    
    $logger = (new EveronLoggerFacade())->buildLogger($configurator);
    
    $logger->info('lorem ipsum');
    

    'pluginClass' => \Everon\LoggerBasic\Plugin\Syslog\SyslogLoggerPlugin::class,
    'pluginFactoryClass' => NULL,
    'logLevel' => Level::Debug,
    'shouldBubble' => true,
    'ident' => NULL,
    'facility' => \LOG_LOCAL0,
    'logopts' => \LOG_PID,
    

    use Everon\Shared\Logger\Configurator\Plugin\LoggerConfigurator; 
    use Everon\Shared\LoggerBasic\Configurator\Plugin\SyslogLoggerPluginConfigurator;
    use Everon\Logger\EveronLoggerFacade;
  
    $syslogPluginConfigurator = (new SyslogLoggerPluginConfigurator)
        ->setLogLevel(Level::Info)
        ->setIdent('foo-bar-ident');
    
    $configurator = (new LoggerConfigurator)
        ->add($syslogPluginConfigurator);
    
    $logger = (new EveronLoggerFacade())->buildLogger($configurator);
    
    $logger->info('lorem ipsum');