wpdesk/wp-logs 问题修复 & 功能扩展

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

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

wpdesk/wp-logs

最新稳定版本:1.13.2

Composer 安装命令:

composer require wpdesk/wp-logs

包简介

README 文档

README

pipeline status coverage report Latest Stable Version Total Downloads Latest Unstable Version License

WordPress Library to log all that can be logged in a modern way.

wp-log is a simple library for WordPress plugins which integrates Monolog with PHP/WP error handling and WooCommerce log system.

By default library logs to WC_Logger and WP Desk log file located in /uploads/wpdesk-logs/wpdesk_debug.log.

Requirements

PHP 5.6 or later.

Composer

You can install the bindings via Composer. Run the following command:

composer require wpdesk/wp-logs

To use the bindings, use Composer's autoload:

require_once 'vendor/autoload.php';

Compatiblity between plugins

To ensure that always the latest and valid version of composer libraries are loaded in WP env you should use a solution that ensure support between plugins and at least decreases the change that something would break. At the moment we recommend using wpdesk/wp-autoloader.

Manual instalation

If you do not wish to use Composer and wpdesk/wp-autoloader, you probably should stop using any existing library as it breaks compatibility between plugins.

Getting Started

Simple usage to get Monolog style logger:

WPDesk\Logger\LoggerFacade::get_logger()->addDebug('some debug message');

// Is equivalent to:
WPDesk\Logger\LoggerFacade::get_logger()->debug('some debug message');

// Is equivalent to:
WPDesk\Logger\LoggerFacade::get_logger()->log(Logger::DEBUG, 'some debug message');

You can also use various Facade helpers:


// log WP_Errors
WPDesk\Logger\LoggerFacade::log_wp_error(new WP_Error(), debug_backtrace());

// log Exceptions
WPDesk\Logger\LoggerFacade::log_exception(new \RuntimeException());

// log message with backtrace
WPDesk\Logger\LoggerFacade::log_message_backtrace('some message', debug_backtrace(), Logger::DEBUG);

// log standard message
WPDesk\Logger\LoggerFacade::log_message('some message', ['some_user' => $user], 'my-app-source', Logger::DEBUG);


Logs can be used whether WC is active or not but if add_action is unavailable then WC logs capture would break.

Project documentation

PHPDoc: https://wpdesk.gitlab.io/wp-logs/index.html

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2018-10-24