eurofirany/ef-log 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-10-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固