Coder Social home page Coder Social logo

Comments (5)

stof avatar stof commented on July 18, 2024

Simply wrap it in the BufferHandler. It is exactly what it is for.

The reason why it is in a separate handler is that it allows you to buffer other handlers as well without duplicating the logic.

from monolog.

olegstepura avatar olegstepura commented on July 18, 2024

Can you please give an example for symfony configuration?

from monolog.

stof avatar stof commented on July 18, 2024
    mail:
      type: fingers_crossed
      action_level: error
      handler: buffered
    buffered:
      type: buffer
      handler: swift
    swift:
      type: swift_mailer
      from_email: error_box @ gmail.com
      to_email: error_box @ gmail.com
      subject: Errors logged
      level: debug
      formatter: my_formatter

Note that I kept the FingersCrossedHandler wrapping the BufferHandler so that you get a mail only when an error occurs.

from monolog.

Seldaek avatar Seldaek commented on July 18, 2024

Right, I guess the mail handler shouldn't be fixed directly, but adding this example to the docs (here and/or as a symfony cookbook) would be nice.

from monolog.

olegstepura avatar olegstepura commented on July 18, 2024

Cool, thanks, it worked! And yes, that definitely must be described in a cookbook article (maybe in "How to use Monolog to write Logs").

Thanks again!

from monolog.

Related Issues (20)

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.