GithubHelp home page GithubHelp logo

rsg-logger's Introduction

Description

A collection of logging utilities that can be used by RSG.

Processors

StandardProcessor

This is the root processor. It does not decorate any other ProcessorInterfaces like the other ones in this library. It is used to add values that all records should contain.

Usage

Rsg\Log\StandardProcessor:
    tags: [ 'monolog.processor' ]
    arguments: [ '%env%', 'some-service' ]

WebProcessor

An adapter for Monolog's WebProcessor. It is used to add "extra" data for web requests. This also decorates any ProcessorInterface.

Usage

Rsg\Log\StandardProcessor:
    arguments: [ '%env%', 'some-service' ]

Rsg\Log\WebProcessor:
    tags: [ 'monolog.processor' ]
    arguments: [ '@Rsg\Log\StandardProcessor' ]

ContextProcessor

Copies important data from the context to the root of the record. This also decorates any ProcessorInterface. The purpose is to allow us to do something like $logger->info( 'some message', [ 'important_field' => 1 ] ); and be able to search "important_field=1" in our log aggregator.

Usage

Rsg\Log\StandardProcessor:
    arguments: [ '%env%', 'some-service' ]

Rsg\Log\ContextProcessor:
    tags: [ 'monolog.processor' ]
    arguments: [ '@Rsg\Log\StandardProcessor' ]

Additionally, one can customize the keys that will be copied.

Rsg\Log\StandardProcessor:
    arguments: [ '%env%', 'some-service' ]

Rsg\Log\ContextProcessor:
    tags: [ 'monolog.processor' ]
    arguments:
        $processor: '@Rsg\Log\StandardProcessor'
        $keys_to_escalate:
            - foo
            - bar
            - baz

Recommended Settings

The settings recommended for all RSG apps should include:

monolog:
    handlers:
        main:
            type: fingers_crossed
            action_level: error
            passthru_level: info
            handler: nested
            formatter: monolog.formatter

and

monolog.formatter:
    class: 'Monolog\Formatter\JsonFormatter'

rsg-logger's People

Contributors

frazjp65 avatar lodzo avatar

Watchers

James Cloos 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.