定制 aainc/newrelic-logger 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

aainc/newrelic-logger

Composer 安装命令:

composer require aainc/newrelic-logger

包简介

README 文档

README

Description

Laravel 上で Newrelic Logs を利用するとき、ログに出力される内容をコントロールするためのライブラリ。

message に送信された文字列や配列、例外をパースして Newrelic Logs へ送信する。

Requirements

  • PHP 7.1 or higher
  • Laravel 5.4 or higher
  • Newrelic api key

Get Started

Installation

composer require aainc/newrelic-logger

Initialize

config/logging.php

      'stack' => [
            'driver' => 'stack',
            'channels' => ['single','newrelic'],
            'ignore_exceptions' => false,
      ],
        
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        
      'newrelic' => [
            'driver' => 'monolog',
            'handler'=> \NewRelic\Monolog\Enricher\Handler::class,
            'tap' => [\Aainc\NewrelicLogger\NewRelicLogs::class],
            'level' => env('LOG_LEVEL', 'debug'),
            'formatter' => 'default',
        ],

config/aa-newrelic-logger.php

<?php

return [
    // Minimum log level describing additional information (default:DEBUG)
    'log_level'   => \Monolog\Logger::DEBUG,
    // This may be useful if the New Relic PHP agent is not installed, or if you wish to log to a different account or region.
    // (default:null)
    'license_key' => null,
    // Can use this to log output with server environment variable information.
    'extra_data'  => []
];

Example

<?php

return [
    'log_level'     => \Monolog\Logger::DEBUG,
    'license_key'   => getenv('NEWRELIC_LICENSE_KEY'),
    'extra_data'    => [
        'host_name' => getenv('HOST_NAME')
    ]
];

Send Logs

Send text message

Log::debug('Send text);

Send array message

Log::debug('array', [
    'hoge' => 'fuga',
    'hogehoge' => 'fugafuga'
]);

Send Exception

Log::debug(new Exception('message');

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固