A Monolog extension for formatting log entries for Google Cloud Logging

1.0.0 2016-04-04 09:26 UTC

This package is auto-updated.

Last update: 2024-04-30 00:29:36 UTC


Author StyleCI Software License Packagist Version Total Downloads Build Status

This library works in conjunction with

fluent-plugin-google-cloud is an output plugin for fluentd which sends logs to the Google Cloud Logging API.

This formatter outputs logs entries in json which the fluent-plugin-google-cloud application understands.


composer require superbalist/monolog-google-cloud-json-formatter


use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Superbalist\Monolog\Formatter;

// create a handler
$handler = new StreamHandler('path/to/your.log', Logger::WARNING);

// use custom formatter in handler
$handler->setFormatter(new GoogleCloudJsonFormatter());

// create a log channel
$log = new Logger('name');

// add records to the log