定制 cebe/yii2-loki-log-target 二次开发

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

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

cebe/yii2-loki-log-target

最新稳定版本:1.2.0

Composer 安装命令:

composer require cebe/yii2-loki-log-target

包简介

Grafana Loki Log Target for Yii2

README 文档

README

Grafana Loki Log Target for Yii2.

Requirements

  • PHP 7.1 or higher (works with PHP 8)
  • Yii 2

Install

composer require cebe/yii2-loki-log-target 

Usage

Add the log target to your application config:

// ... 'components' => [ // ... 'log' => [ // ... 'targets' => [ [ 'class' => \cebe\lokilogtarget\LokiLogTarget::class, //'enabled' => YII_ENV_PROD, 'lokiPushUrl' => 'https://loki.example.com/loki/api/v1/push', 'lokiAuthUser' => 'loki', // HTTP Basic Auth User 'lokiAuthPassword' => '...', // HTTP Basic Auth Password 'levels' => ['error', 'warning', 'info'], // optionally exclude categories 'except' => [ 'yii\db\Connection::open', 'yii\db\Command::execute', 'yii\httpclient\StreamTransport::send', ], // optionally re-map log level for certain categories 'levelMap' => [ // yii category 'yii\web\HttpException:404' => [ // yii level => loki level // set loki level to false, to drop messages with that category '*' => 'info', ], 'yii\web\HttpException:401' => [ // yii level => loki level // set loki level to false, to drop messages with that category '*' => 'warning', ], ], ], ], ], ]

See also https://www.yiiframework.com/doc/guide/2.0/en/runtime-logging#log-targets.

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固