golin/monologgly 问题修复 & 功能扩展

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

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

golin/monologgly

Composer 安装命令:

composer require golin/monologgly

包简介

Loggly helpers for php

README 文档

README

This extends the basic loggly handler provided by monolog, adding the following information as context:

  • the environment
  • whether the log happened on a request, or CLI call
  • information about the http request (url, method)
  • information about the origin of the log call (file and line, class and method (if relevant))
  • some simplified exception information (if the log comes from a "normal" exception log - ie. logging, or __toString-ing the exception)

Note: there is currently a bug with the class and method origin / backtrace information.

Installation

composer require golin/monologgly

Exceptions

To log exception information, simply add the exception to the context:

$logger->debug('Oh No!', ['exception' => $e]);

The exception object will be removed before final logging, and replaced with an array interpretation of it. It will still be available to all other processors added (as long as they are added before the exception information processor (which they will be using the provided service provider)).

Setup with Laravel

Config

Add the following to config/app.php:

    'loggly-token' => env('LOGGLY_TOKEN'),

and add your loggly token to your .env file. Ommitting this will mean that the loggly monlog handler will not be loaded (and nothing will be sent to loggly) - basically, it's safe to not have this key when developing locally.

Provider

Add the following file, as LogglyServiceProvider.php, and put it in your application's service providers config in config/app.php.

Update the $name property with your application's name.

<?php

namespace App\Providers;

use Golin\MonoLoggly\LogglyServiceProvider as BaseProvider;
use Monolog\Monolog;

class LogglyServiceProvider extends BaseProvider {

    /**
     * The log name. This should uniquely identify the log.
     *
     * @var string
     */
    protected $name;

    /**
     * The minimum log level.
     *
     * @var int
     */
    protected $level = Monolog::DEBUG;

    /**
     * A place to construct any other processors that will be added to 
     * the loggly handler.
     *
     * @return array   An array of callables objects
     */
    protected function processors()
    {
        return [];
    }

}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固