PHPackages                             vimar/enhanced-cloud-logging-formatter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. vimar/enhanced-cloud-logging-formatter

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

vimar/enhanced-cloud-logging-formatter
======================================

A Monolog extension for formatting log entries for Google Cloud Logging and Error Reporting

v3.0.7(10mo ago)032.4k↓31.8%1MITPHPPHP ^8.1

Since Nov 13Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/vimar/enhanced-cloud-logging-formatter)[ Packagist](https://packagist.org/packages/vimar/enhanced-cloud-logging-formatter)[ RSS](/packages/vimar-enhanced-cloud-logging-formatter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (26)Used By (0)

Enhanced Cloud Logging Formatter v3.x
=====================================

[](#enhanced-cloud-logging-formatter-v3x)

[![Total Downloads](https://camo.githubusercontent.com/5b211bf8f0bd8c5c71d321bc8ab66cf01b3b30936f476eb5eceffbe99ca5fdd3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f76696d61722f656e68616e6365642d636c6f75642d6c6f6767696e672d666f726d61747465722e737667)](https://packagist.org/packages/vimar/enhanced-cloud-logging-formatter)[![Latest Stable Version](https://camo.githubusercontent.com/10a5e64bbe847beb1565631883bfe6f359f5c8eb26593d0f40744c730ec915c4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76696d61722f656e68616e6365642d636c6f75642d6c6f6767696e672d666f726d61747465722e737667)](https://packagist.org/packages/vimar/enhanced-cloud-logging-formatter)

> **Note** v3.x version is only compatible with Monolog 3.x, please use [v2.x](https://github.com/vimar/enhanced-cloud-logging-formatter/blob/2.x/README.md) if you use Monolog 2.x.

The `Enhanced Cloud Logging Formatter` is a custom formatter for Monolog that replaces the default `GoogleCloudLoggingFormatter` provided by Monolog. This formatter is designed to be used when you want to send logs from your PHP application to Google Cloud Logging.

Features
--------

[](#features)

- **Error Reporting**: The `GoogleCloudLoggingFormatter` enables error reporting, allowing you to control the reporting of error events to Google Cloud Platform (GCP). The `errorReportingLevel` parameter can be modified to specify the minimum log level that triggers error reporting.
- **Complete Log Metadata**: This formatter completes log metadata, providing additional context information before sending logs to GCP. This ensures that logs include comprehensive details, making it easier to analyze and debug issues. Additional metadata contains:

    - Unique RequestId to easily search all the logs for a single HTTP request
    - Exhaustive HTTP info for each log entries, such as request Url, referer, remote IP and User Agent
    - For CLI commands, script command and script filename called
    - When an error is thrown, add information about error context (report location, stack trace, exception message, service name and version number if they are provided)

Installation
------------

[](#installation)

You can install the `Enhanced Cloud Logging Formatter` via Composer:

```
composer require vimar/enhanced-cloud-logging-formatter
```

Basic Usage
-----------

[](#basic-usage)

To use the `GoogleCloudLoggingFormatter`, you need to configure Monolog in your application.

```
