定制 pinkfire/pinkfire-bundle 二次开发

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

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

pinkfire/pinkfire-bundle

最新稳定版本:v2.1.0

Composer 安装命令:

composer require pinkfire/pinkfire-bundle

包简介

Debug application using Pinkfire

关键字:

README 文档

README

Symfony bundle to integrate support of Pinkfire.

Pinkfire is a great tool to help debugging SOA (Service Oriented Architecture) by centralizing logs.

Install

Add the bundle to your composer.json

composer.phar require "pinkfire/pinkfire-bundle"

Update your app/AppKernel.php

<?php
    //...
    if (in_array($this->getEnvironment(), array('dev', 'test'))) {
        //...
        $bundles[] = new Pinkfire\PinkfireBundle\PinkfireBundle();
    }

Update your config (app/config/config_dev.yml)

pinkfire:
    application : "my-application" # required
    host: "localhost"              # Optional
    port: 3000                     # Optional
    log_max_length: -1             # Optional, max length of read input data
    url_blacklist: [ ]             # Optional, array of URIs patterns to ignore
    url_debug: [ "_.*" ]           # Optional, array of URIs patterns to mark as debug
    log_level: warning             # Optional, log level used by the Monolog handler
    enabled: true                  # optional, allow to disable the request/response listener

About enabled: This bundle will not throw exception or crash if it can connect the the pinkfire host. But it adds a small overhead. So if your pinkfire server is not running and you care about performance, you should disable it.

Test it

Open pinkfire in you browser then visit your website (in dev environment). You should see all master requests !

Go further

Monolog

You can forward your logs to pinkfire by updating your monolog config in file app/config/config_dev.yml

monolog:
    handlers:
        pinkfire:
            type: service
            id: pinkfire.monolog_handler

Guzzle

With Guzzle 6 (and csa/guzzle-bundle), a middleware is automatically registered to add the Pinkfire headers (path and channel) to every requests.

With older version of Guzzle, use our Guzzle subscriber

$client = new GuzzleHttp\Client();
$emitter = $client->getEmitter();
$emitter->attach($this->get('pinkfire.guzzle_subscriber'));

Buzz

A bridge is available to interact with Buzz.

The easiest way is to attach the pinkfire.buzz_listener service to a Buzz\Browser. If you use a Buzz\Client and not a Buzz\Browser, use the Pinkfire\PinkfireBundle\Buzz\Client\PinkfireClientDecorator.

Log all the things !

Use the service pinkfire.request_aware.client to send everything you want:

// ...
$client = $this->get('pinkfire.request_aware.client');
$client->push('message', 'level', ['my_context' => 'context'], ['link_1' => 'https://github.com/pinkfire/PinkfireBundle']);
$client->patch('message', 'level', ['my_context' => 'context updated'], ['link_1' => 'https://github.com/pinkfire/PinkfireBundle']);

The RequestAwareClient will automatically push/patch to the path and the channel of the master request.

统计信息

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

GitHub 信息

  • Stars: 8
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-22