承接 jeff/lara-logger 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

jeff/lara-logger

最新稳定版本:v0.0.2

Composer 安装命令:

composer require jeff/lara-logger

包简介

Add logs in your laravel project in database

README 文档

README

LaraLogger is a Laravel package that provides a custom logging solution to store log entries directly in a database. This package includes a ready-to-use DatabaseLogger channel and provides necessary migrations to set up a logs table.

Features

  • Custom Log Channel: Store logs in the database using a dedicated channel.
  • Database Migration: Automatic setup for a logs table.
  • Configurable: Easily integrate into your existing Laravel logging configuration.

Installation

  1. Install the package using Composer:
composer require jeff/lara-logger
  1. Add Jeff\LaraLogger\Providers\LoggingServiceProvider::class to providers list (/bootstrap/providers.php):
<?php

return [
    ...,
    Jeff\LaraLogger\Providers\LoggingServiceProvider::class,
];
  1. Run the Publish command (optional):
php artisan vendor:publish --provider="Jeff\LaraLogger\Providers\LoggingServiceProvider"
  1. Run the migrations to create the logs table:
php artisan migrate
  1. Add the following logging-related environment variables to your .env file if needed:
LOG_CHANNEL=database
LOG_STACK=custom

Usage

  1. Add Logs:
\Illuminate\Support\Facades\Log::info('test ok');
\Illuminate\Support\Facades\Log::info('test ok', [
... ,
'test' => 'tests'
]);
\Illuminate\Support\Facades\Log::error('test ok');
\Illuminate\Support\Facades\Log::warning('test ok');
\Illuminate\Support\Facades\Log::channel('database')->info('test ok');
  1. List Logs, (ex: in a route function):
return \Jeff\LaraLogger\App\Models\LogModel::all(['*']);

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-01