PHP code example of phalcon / logentries

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

    

phalcon / logentries example snippets


use Phalcon\Logger\Adapter\Logentries;

$di->set('logger', function() {
    $logger = new Logentries([
        'token' => getenv('LOGENTRIES_TOKEN'),
        // optional parameters
    ]);
    
    return $logger;
});

use Phalcon\Logger\Adapter\Logentries;

$di->set('logger', function() {
    $logger = new Logentries([
        'token'             => getenv('LOGENTRIES_TOKEN'),
        'host_name_enabled' => true,
        'host_name'         => 'Custom_host_name_here',
        'host_id'           => 'Custom_ID_here_12345'
    ]);

    return $logger;
});

use Phalcon\Logger;
use Phalcon\Logger\Adapter\Logentries as LeAdapter;

$logger = new LeAdapter(['token' => 'ad43g-dfd34-df3ed-3d3d3']);

// These are the different log levels available:
$logger->critical('This is a critical message');
$logger->emergency('This is an emergency message');
$logger->debug('This is a debug message');
$logger->error('This is an error message');
$logger->info('This is an info message');
$logger->notice('This is a notice message');
$logger->warning('This is a warning message');
$logger->alert('This is an alert message');


// You can also use the log() method with a Logger constant:
$logger->log('This is another error message', Logger::ERROR);

// If no constant is given, DEBUG is assumed.
$logger->log('This is a message');

// Closes the logger
$logger->close();
sh
$ php composer.phar install