customlogcreator / customlogging
Laravel 自定义日志包是一种增强 Laravel 应用程序日志功能的包。它提供了创建自定义日志处理器、将日志文件组织到文件夹中以及将日志上传到 Amazon S3 桶的选项。
v1.0.0
2023-09-30 19:16 UTC
Requires
- illuminate/support: ~9|~10
Requires (Dev)
- orchestra/testbench: ~7
- phpunit/phpunit: ~9.0
This package is auto-updated.
Last update: 2024-09-30 01:54:45 UTC
README
文档、安装和用法说明
安装
通过 Composer
$ composer require customlogcreator/customlogging
$ php artisan vendor:publish --tag=customlogging
添加到提供者
$ CustomLogCreator\CustomLogging\CustomLoggingServiceProvider::class,
用法说明
Log::channel('dynamic_logs')->info('Log message here');
配置
在 custom-logging.php 配置文件中,您可以通过修改提供的配置数组来自定义包的行为。以下是一些配置选项:
-
namespace: 自定义日志处理器和格式化程序所在的命名空间。
-
is_folder: 指示是否应使用文件夹结构来组织日志文件。
-
folder_name: 当 'is_folder' 设置为 true 时,将日志文件存储的文件夹名称。
-
path_name: 当 'is_folder' 设置为 false 时,存储日志文件的路径名称。
-
is_upload_s3_bucket: 指示是否应将日志文件上传到 Amazon S3 桶。
-
aws_destination_path: 日志文件应上传到 S3 桶中的目标路径。仅当 'is_upload_s3_bucket' 设置为 true 时适用。
config/customlogging.php
return [
'is_directory' => true, // create new directory in logs folder
'directory_name' => '', // logs/01-01-2023/01-01-202.log
'path_name' => '', // 01-01-2023.log
'is_upload_s3_bucket' => false,
'aws_destination_path' => '',
];