• Stars
    star
    169
  • Rank 224,453 (Top 5 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 5 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Logging to a discord channel in Laravel

Laravel Discord Logger

Latest Version on Packagist Software License Total Downloads

marvinlabs/laravel-discord-logger is a laravel package providing a logging handler to send logs to a Discord channel.

Installation

You can install the package via composer:

composer require marvinlabs/laravel-discord-logger

If you are using Laravel 5.5 or later, the service provider will automatically be discovered.

On earlier versions, you need to do that manually. You must install the service provider:

// config/app.php
'providers' => [
    ...
    MarvinLabs\DiscordLogger\ServiceProvider::class
];

You can then publish the configuration file:

php artisan vendor:publish --provider "MarvinLabs\DiscordLogger\ServiceProvider"

Setup

Prepare the discord channel web hook

Create a discord web hook for the channel which will receive the logs.

Prepare the logger configuration

You must add a new channel to your config/logging.php file:

// config/logging.php
'channels' => [
    //...
    'discord' => [
        'driver' => 'custom',
        'via'    => MarvinLabs\DiscordLogger\Logger::class,
        'level'  => 'debug',
        'url'    => env('LOG_DISCORD_WEBHOOK_URL'),
        'ignore_exceptions' => env('LOG_DISCORD_IGNORE_EXCEPTIONS', false),
    ],
];

You can then provide the web-hook URL in your .env file:

LOG_DISCORD_WEBHOOK_URL=https://discordapp.com/api/webhooks/abcd/1234

Use the logger channel

You have two options: log only to discord or add the channel to the stack

Log only to the discord channel

Simply change the .env variable to use the discord channel

LOG_CHANNEL=discord

Add the channel on top of other channels

Add the channel to the stack in the config/logging.php configuration:

// config/logging.php
'channels' => [
    //...
    'stack' => [
        'driver'   => 'stack',
        'channels' => ['single', 'discord'],
    ],
];

Then make sure the logging channel is set to stack in your .env file:

LOG_CHANNEL=stack

Logging to multiple Discord channels

Of course, you can send your log messages to multiple Discord channels. Just create as many channels as desired in config/logging.php and put them in the stack. Each channel should be named differently and should point to a different web hook URL.

What does it look like?

You can get a preview of what it looks like using each of the provided converters.

Screenshot

Version history

See the dedicated change log

Credits

License

The MIT License (MIT). Please see License File for more information.

More Repositories

1

android-floatinglabel-widgets

Floating label input widgets
Java
446
star
2

android-intents

A small library which will save you from writing the same intent creation code again and again for the most simple tasks
Java
421
star
3

android-slideshow-widget

A set of widgets to create smooth slideshows with ease.
Java
209
star
4

laravel-setup-wizard

A Laravel package to help you build a web setup wizard for your application
PHP
204
star
5

notepad-plus-plus-scss-syntax-highlighting

Add some syntax highlighting with the default CSS settings provided by Notepad++
133
star
6

laravel-luhn

Laravel utilities to ease validation and computation of credit cards, SIREN, etc.
PHP
106
star
7

android-unlocker-library

A library to ease implementation of unlock application for your freemium apps
Java
104
star
8

android-constrained-widgets

Set of Android widgets that will respect a given aspect ratio
Java
43
star
9

laravel-html-bootstrap-4

Bootstrap 4 fluent HTML builder
PHP
42
star
10

android-tutorials-custom-selectable-listview

Source code for our tutorial about how to get checkable rows in a custom ListView
Java
32
star
11

customer-area

A WordPress plugin to offer private content to your users -- MOVED TO https://gitlab.com/wp-customerarea/plugins/customer-area
PHP
31
star
12

acra-server

A server to collect crash data of your android applications
PHP
26
star
13

android-progress-panel

A widget to hold information that can be shown after a task completes
Java
25
star
14

laravel-html-font-awesome

A fluent html builder for Font Awesome icons
PHP
14
star
15

bxslider-for-wordpress

bxSlider for WordPress integrates the cool responsive content slider "bxSlider jQuery plugin" in your very own WordPress site
JavaScript
5
star
16

wpca-twenty-twelve

Sample theme for Customer Area developers -- MOVED TO https://gitlab.com/wp-customerarea/themes/wpca-twenty-twelve/
PHP
4
star
17

wpca-translations

Translation files for add-ons to WP Customer Area plugin -- MOVED to https://gitlab.com/wp-customerarea/tools/wpca-translations/
3
star
18

wpca-products-build-environment

Our developer environment to help building add-ons and contributing to the plugin -- MOVED TO https://gitlab.com/wp-customerarea/tools/wpca-products-build-environment
PHP
3
star
19

acra-bug-generator

A simple android application to create crashes for testing your ACRA backend
Java
2
star
20

jquery.hoverme

A jQuery plugin for cool sliding boxes
JavaScript
1
star
21

grunt-wpca

Grunt plugin to ease WP Customer Area development
JavaScript
1
star
22

wordpress-project-starter

A basic structure to easily start a WordPress project
PHP
1
star