定制 ttree/chromelogger 二次开发

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

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

ttree/chromelogger

最新稳定版本:0.9

Composer 安装命令:

composer require ttree/chromelogger

包简介

A TYPO3 Flow Logger Backend to send log the the Chrome Console

README 文档

README

The Logger Backend can display your application in the Chrome Console, with the extension "Chrome Logger".

Sample image based on the TYPO3 Neos Demo Site

How to use it ?

You need to configure the Logger Backend in Settings.yaml::

TYPO3:
  Flow:
    log:
      systemLogger:
        backend:
          0: 'TYPO3\Flow\Log\Backend\FileBackend'
          1: 'Ttree\ChromeLogger\Log\Backend\ChromeConsoleBackend'
        backendOptions:
          0:
            logFileURL: '%FLOW_PATH_DATA%Logs/System_Development.log'
            createParentDirectories: TRUE
            severityThreshold: '%LOG_INFO%'
            maximumLogFileSize: 10485760
            logFilesToKeep: 1
            logMessageOrigin: FALSE
          1:
            severityThreshold: '%LOG_CRIT%'

By default the package use a grouped output to show log on mulitple lines:

Default Output

Use it in your own package

You can use the default system logger provided by Flow, but you can also inject the ChomeLoggerServive in your own class.

Check the following code for some example:

$this->chromeLoggerInstance->log('Foo');
$this->chromeLoggerInstance->info('Foo');
$this->chromeLoggerInstance->warn('Foo');
$this->chromeLoggerInstance->error('Foo');

// You can group your log entry, groupCollapsed method for a more compact rendering
$this->chromeLoggerInstance->group('String');
$this->chromeLoggerInstance->log('Foo');
$this->chromeLoggerInstance->log(array('Foo'));
$this->chromeLoggerInstance->groupEnd();

$this->chromeLoggerInstance->group('Table');
$this->chromeLoggerInstance->table('Foo');
$this->chromeLoggerInstance->table(array('Foo'));
$this->chromeLoggerInstance->groupEnd();

$this->chromeLoggerInstance->group('Object');
$this->chromeLoggerInstance->log($this->request->getHttpRequest());
$this->chromeLoggerInstance->log(new \DateTime());
$this->chromeLoggerInstance->groupEnd();

Warning: HTTP Header are limited to 256kb, currently if you hit the limit, you wont see any logs in the console.

Sample image with more advanced log values

TODO

Feel free to open issue if you need a specific feature and better send a pull request. Here are some idea for future improvements:

  • Support for exception and backtrace
  • Add support for Header compression (gzip) to mitigate the 256kb limit (need change in the Chrome extension too)
  • Better reflexion, maybe

Acknowledgments

Development sponsored by ttree ltd - neos solution provider.

License

Licensed under GPLv3+, see LICENSE

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-01-20