All Projects → B-Galati → monolog-sentry-handler

B-Galati / monolog-sentry-handler

Licence: MIT license
Monolog handler for Sentry PHP SDK v2 with breadcrumbs support

Programming Languages

PHP
23972 projects - #3 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to monolog-sentry-handler

Easy Log Handler
Human-friendly log files that make you more productive
Stars: ✭ 2,070 (+5988.24%)
Mutual labels:  monolog, logger, monolog-handler
Quicklogger
Library for logging on files, console, memory, email, rest, eventlog, syslog, slack, telegram, redis, logstash, elasticsearch, influxdb, graylog, Sentry, Twilio, ide debug messages and throw events for Delphi/Firemonkey/freepascal/.NET (Windows/Linux/OSX/IOS/Android).
Stars: ✭ 137 (+302.94%)
Mutual labels:  sentry, logger
Monolog Bundle
Symfony Monolog Bundle
Stars: ✭ 2,532 (+7347.06%)
Mutual labels:  monolog, logger
monolog-http
A collection of monolog handlers that use a PSR-18 HTTP Client to send your logs
Stars: ✭ 34 (+0%)
Mutual labels:  monolog, monolog-handler
nextcloud sentry
Sentry integration for Nextcloud
Stars: ✭ 26 (-23.53%)
Mutual labels:  sentry, sentry-php
logger sentry
Elixir Logger backend for Sentry
Stars: ✭ 20 (-41.18%)
Mutual labels:  sentry, logger
app
Buggregator is a beautiful, lightweight debug server build on Laravel that helps you catch your smpt, sentry, var-dump, monolog, ray outputs. It runs without installation on multiple platforms.
Stars: ✭ 259 (+661.76%)
Mutual labels:  sentry, monolog
sentry-fastlane-plugin
Official fastlane plugin for Sentry
Stars: ✭ 100 (+194.12%)
Mutual labels:  sentry
sentry-prometheus
Export hosted sentry statsd metrics to prometheus
Stars: ✭ 22 (-35.29%)
Mutual labels:  sentry
django-template
The ultimate Django template: production ready Django 3.2 with Docker, HTTPS and CI/CD using Github actions ‎️‍🔥
Stars: ✭ 20 (-41.18%)
Mutual labels:  sentry
seas-logger
An effective,fast,stable log package for PHP.
Stars: ✭ 46 (+35.29%)
Mutual labels:  logger
Mail
RiiConnect24 Mail Scripts. OSS.
Stars: ✭ 11 (-67.65%)
Mutual labels:  sentry
mongoose-morgan
An npm package for saving morgan log inside MongoDB
Stars: ✭ 14 (-58.82%)
Mutual labels:  logger
ptkdev-logger
🦒 Beautiful Logger for Node.js: the best alternative to the console.log statement
Stars: ✭ 117 (+244.12%)
Mutual labels:  logger
spdlog setup
spdlog setup initialization via file configuration for convenience.
Stars: ✭ 68 (+100%)
Mutual labels:  logger
redux-sentry
Middleware that logs all your store and actions on exception to Sentry with raven-js
Stars: ✭ 13 (-61.76%)
Mutual labels:  sentry
chronica
Logger framework for Erlang applications
Stars: ✭ 57 (+67.65%)
Mutual labels:  logger
use-reducer-logger
A very basic logger for the useReducer function in the React Hooks API.
Stars: ✭ 89 (+161.76%)
Mutual labels:  logger
DataTransHub
跨平台Android/iOS海量数据上报组件,基于Xlog完善,解决Xlog痛点问题。
Stars: ✭ 103 (+202.94%)
Mutual labels:  logger
BLogger
An easy to use modern C++14/17 async cross-platform logger which supports custom formatting/patterns, colored output, Unicode, file logging, log rotation & more!
Stars: ✭ 23 (-32.35%)
Mutual labels:  logger

Monolog Sentry Handler

Build Status Latest Version MIT License

It is a Monolog handler for Sentry PHP SDK v2 with breadcrumbs support.

Features

  • Send each log record to a Sentry server
  • Send log records as breadcrumbs when they are handled in batch; the main reported log record is the one with the highest log level
  • Send log along with exception when one is set in the main log record context
  • Customize data sent to Sentry to fit your needs
  • Compatible with Monolog 1 and 2
  • Workaround for an issue that prevents sending logs in long running process

Requirements

Installation

The suggested installation method is via composer:

composer require bgalati/monolog-sentry-handler

Basic usage

<?php

use BGalati\MonologSentryHandler\SentryHandler;
use Sentry\State\Hub;

$sentryHandler = new SentryHandler(Hub::getCurrent());

/** @var $logger Monolog\Logger */
$logger->pushHandler($sentryHandler);

// Add records to the log
$logger->debug('Foo');
$logger->error('Bar');

Check out the handler constructor to know how to control the minimum logging level and bubbling.

ℹ️

  • It is a good idea to combine this handler with a FingersCrossedHandler and a BufferHandler to leverage Sentry breadcrumbs. It gives maximum context for each Sentry event and prevents slowing down http requests.
  • Beware of issue getsentry/sentry-php#878 that can be solved by using another HTTP client

Check out the symfony guide for a complete example that addresses all these points

Documentation

FAQ

What are the differences with the official Monolog Sentry handler?

It is pretty much the same thing but this one captures Monolog records as breadcrumbs when flushing in batch.

It provides a workaround for issue getsentry/sentry-php#811 which prevents sending events to Sentry in long running process.

Breadcrumbs support has been proposed in a pull request that has been refused for good reasons that can be checked in the PR. Basically the official one aims to be as simple as possible.

Why symfony guide while there is an official Symfony bundle?

The symfony official bundle relies on Symfony KernelException event to send event to Sentry while Symfony already cares about logging/capturing errors thanks to Monolog bundle.

At the end, it's not possible to report silenced error with the bundle which can be problematic if you want to be aware of problems without making your app crashed.

What about contributing it to the Monolog project?

As per this comment, Monolog project does not accept new handler with 3rd party dependencies.

For new handlers with third-party dependencies IMO the right way is to publish as a third-party package, with requires on monolog and on whichever dependency is needed. It lets Composer resolve everything which makes more sense really.

Contributing

Fork me.

Install dependencies with make vendor.

Run tests with make tests.

Changelog

See CHANGELOG.md.

Credits

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].