eurofirany/ef-log
最新稳定版本:v2.2
Composer 安装命令:
composer require eurofirany/ef-log
包简介
App logs
关键字:
README 文档
README
Package for creating logs
Install
composer require eurofirany/ef-log
php artisan EfLog:install
Configuration
<?php
return [
'app_name' => env('APP_NAME'),
'app_env' => env('APP_ENV'),
'app_url' => env('APP_URL'),
'logs_url' => env('APP_URL').'/ef-log/logs/',
'logs_token' => env('EF_TOKEN'),
'logs_extended_tables' => [
//
],
'logs_teams_channel_url' => env('EF_LOG_TEAMS_CHANNEL_URL'),
];
Variables for .env
EF_LOG_TEAMS_CHANNEL_URL=
Log types
INFO
SUCCESS
ERROR
WARNING
Commands for groups
php artisan EfLog:addGroup
# Optional parameters
# --name= --translation=
php artisan EfLog:removeGroup
# Optional parameter
# --name=
Commands for operations
php artisan EfLog:addOperation
# Optional parameters
# --name= --translation=
php artisan EfLog:removeOperation
# Optional parameter
# --name=
Methods
// Type
->info('TITLE')
->success('TITLE')
->error('TITLE')
->warning('TITLE')
->description('DESC') // Optional
->group('GROUP')
->operation('OPERATION')
->properties('TABLE', [
'KEY1' => 'VALUE1',
'KEY2' => 'VALUE2'
]) // Optional - Save properties in extended table
->parent($parentId) // Optional
->save() // Save log
->send() // Send notification
->show(); // Show log
Example usage
#1
EfLog::create()
->success('title')
->description('description')
->properties('Files', [
'name' => 'filename'
])
->group('Files')
->operation('Download')
->save()
->send()
->show();
#2
EfLog::create()
->error('title')
->parent('123')
->save();
#3
EfLog::create()
->info('title')
->send();
#4
EfLog::create()
->warning('title')
->description('description')
->show();
Extended tables
php artisan EfLog:extend
Define table in config
<?php
// ef_log
return [
'logs_extended_tables' => [
'Files',
]
];
Example model for extended table
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class EfLogExtendedTableFilesLog extends Model
{
public $timestamps = false;
protected $fillable = [
'log_id',
'name'
];
}
Example migration for extended table
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateEfLogExtendedTableFilesLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ef_log_extended_table_files_logs', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('log_id');
$table->string('name');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('ef_log_extended_table_files_logs');
}
}
Defined routes
// Api
ef-log/logs
ef-log/settings // GET|POST
统计信息
- 总下载量: 80
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-10-12