Skip to content

👍 Easy integrate Logz.io into PHP & Laravel 5.6+ Application

License

Notifications You must be signed in to change notification settings

oanhnn/laravel-logzio

Repository files navigation

Introduction

Build Status Coverage Status Latest Version Total Downloads Requires PHP Software License

Easy integrate Logz.io into PHP and Laravel 5.6+ Application

Main features

  • Make Logz.io handler for Monolog
  • Make logzio driver for integrate Logz.io into Laravel Application

Requirements

  • php >=7.1.3
  • Laravel 6.0+ (when using with Laravel)

We tested with Laravel 6.0+ and php 7.2+ . But it can working with Laravel 5.6+ and php >= 7.1.3

Installation

Begin by pulling in the package through Composer.

$ composer require oanhnn/laravel-logzio

Usage

PHP (non Laravel)

<?php

use Laravel\Logzio\Log\Handler;
use Monolog\Logger;

$config = [
    'token' => '...',
    'type' => 'http-bulk',
    'ssl' => true,
    'region' => '',
];

$logger = new Logger('log-name');
$logger->pushHandler(new Handler(Logger::DEBUG, true, $config);

$logger->info('Some message');

Laravel

In config/logging.php file, config you log with driver logzio

<?php
return [
    // ...
	'custom' => [
	    'driver'           => 'logzio',
	    'name'             => 'channel-name',
	    'token'            => 'logz-access-token',
	    'type'             => 'http-bulk',
	    'ssl'              => true,
	    'level'            => 'info',
	    'bubble'           => true,
	    'region'           => 'eu', // leave empty for default region
	    'timestamp_format' => '', // leave empty for default format (requires UTC time)
	],
	// ...
];

In your code using

Log::channel('custom')->info('Some message');

See more in Laravel document

Changelog

See all change logs in CHANGELOG

Testing

$ git clone git@github.com/oanhnn/laravel-logzio.git /path
$ cd /path
$ composer install
$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email to Oanh Nguyen instead of using the issue tracker.

Credits

License

This project is released under the MIT License.
Copyright © 2020 Oanh Nguyen.