Giter Site home page Giter Site logo

superbalist / monolog-google-cloud-json-formatter Goto Github PK

View Code? Open in Web Editor NEW
15.0 34.0 7.0 11 KB

A Monolog extension for formatting log entries for Google Cloud Logging

License: MIT License

PHP 100.00%
monolog-extension monolog php superbalist google-cloud google-cloud-logging google-cloud-platform logging logging-library monolog-google-cloud-json-formatter

monolog-google-cloud-json-formatter's Introduction

A Monolog extension for formatting log entries for Google Cloud Logging

Author StyleCI Software License Packagist Version Total Downloads Build Status

This library works in conjunction with https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud

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.

Installation

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

Usage

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');
$log->pushHandler($handler);

// add records to the log
$log->addWarning('Foo');
$log->addError('Bar');

monolog-google-cloud-json-formatter's People

Contributors

etiennemarais avatar matthewgoslett avatar shad0wfir3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.