t3n/flow-log
最新稳定版本:1.0.5
Composer 安装命令:
composer require t3n/flow-log
包简介
Small package that provides several Logger for the Flow Framework
README 文档
README
Warning
This plugin is no longer being maintained and there is no superseding package at this time
t3n.FlowLog
This package adds a few helper to log Flow Messages.
🔧 Still Work in Progress 🔧
ConsoleStorage
If you'd like to log your Exceptions to the console, for instance stderr or stdout, he ConsoleStorage is for you. It will log all throwables directly to the console as JSON. The JSON is formatted to be parsed by google Stackdriver.
To enable the ConsoleStorage you need to adjust your Settings.yaml like this:
Neos: Flow: log: throwables: storageClass: t3n\FlowLog\ThrowableStorage\ConsoleStorage optionsByImplementation: 't3n\FlowLog\ThrowableStorage\ConsoleStorage': streamName: 'stderr'
The StreamName could either be stderr or stdout.
BigQueryLogger
The BigQueryLogger is an AbstractBackend so that you can use it like an normal Logger like FileBackend. If you want to log into BigQuery, here is your 3 Step manual:
- configure BigQuery (dataset, table, keyFile)
- create a
BigQueryLoggerviaPsrLoggerFactory - map your custom
BigQueryLoggerviaObjects.yamlto actually use it
1) Configure BigQueryLogger
t3n: FlowLog: bigQuery: dataset: 't3n_flowlog' table: 'application_log' expirationMs: '7776000000' # 90 days keyFilePath: '/path/to/google/key.json'
ℹ️ All logs will be written into a partitioned table in BigQuery. This means that you have a "overall" table with multiple tables for each day. This day-tables can be deleted automatically via expirationMs. If you want to store your logs forever just ignore this Setting and let it blank.
2) Create your own Instance of BigQueryLogger
To actually use the BigQueryLogger you have to define your own in your Settings.yaml. The important part is loggerName ("applicationXyImportLogger") and the internal Name bigQueryLogger.
bigQueryLogger will be used in Step 3, loggerName is the actual name for the BigQueryTable (inserted for each row).
Neos: Flow: log: psr3: 'Neos\Flow\Log\PsrLoggerFactory': bigQueryLogger: class: 't3n\FlowLog\Backend\BigQueryLogger' options: loggerName: 'applicationXyImportLogger'
You can create as many loggers as you want. This is really usefull if you want to "split" your logs in your BigQueryTable. E.g. one Logger for Imports, one for User-Requests, etc.
3) Map your BigQueryLogger via Objects.yaml
Last but not least you have to define your Logging-Factory to use your BigQueryLogger.
Therefore edit your Objects.yaml like this:
t3n\FlowLog\Command\ExampleCommandController: # <- adjust properties: logger: object: factoryObjectName: Neos\Flow\Log\PsrLoggerFactoryInterface factoryMethodName: get arguments: 1: value: bigQueryLogger
Now you are able to use it:
/** * @var Psr\Log\LoggerInterface */ protected $logger; .... $this->logger->log(LogLevel::INFO, 'First log entry.', ['test' => true]);
ServiceContext
ℹ️ Important if you want to log multiple applications/environments (e.g.) in BigQuery.
You should also set the ServiceContext that is used by StackDriver and BigQueryLogger:
t3n: FlowLog: serviceContext: service: 'flow-app' version: 'master'
t3n/flow-log 适用场景与选型建议
t3n/flow-log 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.32k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 12 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 t3n/flow-log 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 t3n/flow-log 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 11.32k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2019-12-12
