承接 themehybrid/hybrid-log 相关项目开发

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

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

themehybrid/hybrid-log

最新稳定版本:1.0.0-beta.4

Composer 安装命令:

composer require themehybrid/hybrid-log

包简介

Log package for the Hybrid Core framework.

关键字:

README 文档

README

The Hybrid Logger package is a powerful and flexible tool for managing and recording log messages in Hybrid applications. It allows developers to configure various log channels, set log levels, and choose from different drivers. With options to tailor log storage and behavior, it facilitates effective debugging, error tracking, and application monitoring, enhancing the robustness and reliability of Hybrid-powered projects.

Requirements

  • PHP 8.0+.
  • Composer for managing PHP dependencies.

Documentation

You need to register the service provider during your bootstrapping process:

$slug->provider( \Hybrid\Log\Provider::class );
$slug->provider( \Hybrid\Log\Context\Provider::class );

Sample /config/logging.php

<?php

use Monolog\Handler\NullHandler;
use Monolog\Logger;
use function Hybrid\storage_path;
use function Hybrid\Tools\env;

return [

    /*
    |--------------------------------------------------------------------------
    | Default Log Channel
    |--------------------------------------------------------------------------
    |
    | This option defines the default log channel that gets used when writing
    | messages to the logs. The name specified in this option should match
    | one of the channels defined in the "channels" configuration array.
    |
    */
    'default'      => env( 'LOG_CHANNEL', 'stack' ),

    /*
    |--------------------------------------------------------------------------
    | Deprecations Log Channel
    |--------------------------------------------------------------------------
    |
    | This option controls the log channel that should be used to log warnings
    | regarding deprecated PHP and library features. This allows you to get
    | your application ready for upcoming major versions of dependencies.
    |
    */

    'deprecations' => [
        'channel' => env( 'LOG_DEPRECATIONS_CHANNEL', 'null' ),
        'trace'   => false,
    ],

    /*
    |--------------------------------------------------------------------------
    | Log Channels
    |--------------------------------------------------------------------------
    |
    | Here you may configure the log channels for your application. Out of
    | the box, hybrid uses the Monolog PHP logging library. This gives
    | you a variety of powerful log handlers / formatters to utilize.
    |
    | Available Drivers: "single", "daily", "slack", "syslog",
    |                    "errorlog", "monolog",
    |                    "custom", "stack"
    |
    */
    'channels'     => [
        'stack'      => [
            'driver'            => 'stack',
            'channels'          => [
					'single',
					'daily',
					// 'sentry',
				],
            'ignore_exceptions' => false,
        ],
        'single'     => [
            'driver' => 'single',
            'path'   => storage_path( 'logs/hybrid.log' ),
            'level'  => env( 'LOG_LEVEL', 'debug' ),
        ],
        'daily'      => [
            'driver' => 'daily',
            'path'   => storage_path( 'logs/hybrid.log' ),
            'level'  => env( 'LOG_LEVEL', 'debug' ),
            'days'   => 14,
        ],
        'null'       => [
            'driver'  => 'monolog',
            'handler' => NullHandler::class,
        ],
        'emergency'  => [
            'path' => storage_path( 'logs/hybrid.log' ),
        ],
        'sentry'     => [
            'driver' => 'sentry',
            'level'  => Logger::ERROR, // The minimum monolog logging level at which this handler will be triggered
            'bubble' => true, // Whether the messages that are handled can bubble up the stack or not
        ],
    ],

];

Sample usage

use Hybrid\Log\Facades\Log;
use Hybrid\Log\Facades\Context;

Context::add('some_key', 'value');
Context::add('some_other_key', 'value');

Log::emergency($message);
Log::alert($message);
Log::critical($message);
Log::error($message);
Log::warning($message);
Log::notice($message);
Log::info($message);
Log::debug($message);

Log::channel('single')->info('Something happened!');
Log::stack(['single', 'daily'])->info('Something happened!');

Copyright and License

This project is licensed under the GNU GPL, version 2 or later.

2008 – 2024 © Theme Hybrid.

Other Licenses

Hybrid Log utilizes code from Illuminate.

https://github.com/illuminate/log

License: MIT - https://opensource.org/licenses/MIT Copyright (c) Taylor Otwell

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-03-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固