承接 marick/laravel-google-cloud-logging 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

marick/laravel-google-cloud-logging

最新稳定版本:v2.0.0

Composer 安装命令:

composer require marick/laravel-google-cloud-logging

包简介

README 文档

README

Companion packages: Cloud Scheduler, Cloud Tasks

Introduction

This package lets you use Google Cloud Logging as the log driver for Laravel.

The package will automatically detect the environment it's running in (currently supports Cloud Run or App Engine), and attach the correct labels to the log entry so the logs appear in the application service.

Installation

Install the package with Composer:

composer require marick/laravel-google-cloud-logging

Add a new logging channel in config/logging.php:

'google_cloud' => [
    'driver' => 'google_cloud',
    'location' => env('GOOGLE_CLOUD_LOGGING_LOCATION'),
],

Use the new channel:

LOG_CHANNEL=google_cloud

Important

A location is mandatory to make log entries appear in Cloud Run or App Engine.

How to

Use log context

use Illuminate\Support\Facades\Log;

Log::debug('user logged in', [
    'user' => 5,
]);

The above context will be added in Cloud Logging:

{
  "jsonPayload": {
    "message": "user logged in"
  },
  "labels": {
    "user": 5
  }
}

Use Context

use Illuminate\Support\Facades\Context;
use Illuminate\Support\Facades\Log;

Context::add('user', 5);

Log::alert('user logged in');

The above context will be added in Cloud Logging:

{
  "jsonPayload": {
    "message": "user logged in"
  },
  "labels": {
    "user": 5
  }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-04-26