承接 azatakmyradov/watchlog 相关项目开发

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

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

azatakmyradov/watchlog

最新稳定版本:v1.0.3

Composer 安装命令:

composer require azatakmyradov/watchlog

包简介

Watch logs from your application

README 文档

README

WatchLog is a Laravel package that provides an easy-to-use logging solution for your Laravel applications. It allows you to send log messages to a remote API endpoint, making it simple to centralize your logs and monitor your application's behavior.

Features

  • Simple integration with Laravel applications
  • Support for all PSR-3 log levels
  • Ability to include context data with log messages
  • User authentication information included in logs
  • Event listener for custom logging events
  • Facade for easy static method calls

Installation

You can install the package via Composer:

composer require akmyradov/watchlog

Configuration

After installation, publish the configuration file:

php artisan vendor:publish --provider="Akmyradov\WatchLog\WatchLogServiceProvider"

This will create a config/watchlog.php file. Update values in the .env with your WatchLog API credentials:

WATCHLOG_BASE_URL=""
WATCHLOG_PROJECT_ID=1
WATCHLOG_SECRET=""
WATCHLOG_DRIVER=""

Usage

Basic Logging

You can use the WatchLog facade to log messages:

use Akmyradov\WatchLog\Facades\WatchLog;

WatchLog::info('This is an info message');
WatchLog::error('An error occurred', ['error' => $exception->getMessage()]);

Available Methods

  • emergency(string $message, array $context = [])
  • alert(string $message, array $context = [])
  • critical(string $message, array $context = [])
  • error(string $message, array $context = [])
  • warning(string $message, array $context = [])
  • notice(string $message, array $context = [])
  • info(string $message, array $context = [])
  • debug(string $message, array $context = [])

Custom Log Method

If you need more control, you can use the log method directly:

WatchLog::log('custom_level', 'Custom log message', ['key' => 'value']);

Event Listening

You can set up WatchLog to listen for specific events and log them automatically:

use Akmyradov\WatchLog\Facades\WatchLog;

WatchLog::listen(YourCustomEvent::class);

License

MIT License

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-21