wangyipinglove/lumen-alilog

Aliyun SLS Log For Lumen
67
Install
composer require wangyipinglove/lumen-alilog
PHP:~7.0
License:MIT
Last Updated:Jul 13, 2020
Links: GitHub  ·  Packagist
Maintainer: wangyiping

Aliyun SLS Log For Lumen

Install

Via Composer

$ composer require wangyiping/lumen-alilog

Config

Add following service providers into your providers array in bootstrap/app.php

$app->configure('sls');
$app->register(Wangyipinglove\LumenAliLog\Logging\SLSFormatter::class);

Edit your .env file

LOG_CHANNEL=sls

ALI_LOGSTORE_ENDPOINT=xxxxxxxx
ALI_LOGSTORE_ACCESS_KEY_ID=xxxxxxxx
ALI_LOGSTORE_ACCESS_KEY_SECRET=xxxxxxxx
ALI_LOGSTORE_PROJECT_NAME=my-project
ALI_LOGSTORE_NAME=test-app

You should update ALI_LOGSTORE_ENDPOINT to internal endpoint in production mode

Run php artisan lumen-sls:publish-config to publish configs (config/sls.php)

Make configuration changes if needed

Usage

First create a project and store at Aliyun SLS Console

Then update ALI_LOGSTORE_ENDPOINT, ALI_LOGSTORE_PROJECT_NAME, ALI_LOGSTORE_NAME in .env

Push a test message to queue

Log::info('Test Message', ['myname'=>'wangyiping']);

//or you can use `app('sls')` 

app('sls')->putLogs([
	'type' => 'test',
	'message' => json_encode(['This should use json_encode'])
]);

//or you can use `SLSLog` directly 

SLSLog::putLogs([
	'type' => 'test',
	'message' => json_encode(['This should use json_encode'])
]);

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

631,580,251 9,707
laravel/framework

The Laravel Framework.

580,311,802 34,925
laravel/tinker

Powerful REPL for the Laravel framework.

489,754,436 7,444
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

404,034,618 608
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

387,976,821 4,658