PHP code example of kroyeeg / laravel-teams-logging

1. Go to this page and download the library: Download kroyeeg/laravel-teams-logging library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kroyeeg / laravel-teams-logging example snippets


Kroyeeg\LaravelTeamsLogging\LoggerServiceProvider::class

$app->register(Kroyeeg\LaravelTeamsLogging\LoggerServiceProvider::class);

$app->configure('teams');

'teams' => [
    'driver'    => 'custom',
    'via'       => \Kroyeeg\LaravelTeamsLogging\LoggerChannel::class,
    'level'     => 'debug',
    'url'       => env('INCOMING_WEBHOOK_URL'),
    'style'     => 'simple',    // Available style is 'simple' and 'card', default is 'simple'
],

'teams' => [
    'driver'    => 'custom',
    'via'       => \Kroyeeg\LaravelTeamsLogging\LoggerChannel::class,
    'level'     => 'debug',
    'url'       => env('INCOMING_WEBHOOK_URL'),
    'style'     => 'simple',    // Available style is 'simple' and 'card', default is 'simple'
    'name'      => 'Dummy Project'
],

Log::channel('teams')->error('Error message');

Log::channel('teams')->error('Error message', [
    'Assigned to' => 'Unassigned',
    'stack trace' => $e->getTraceAsString(), // could not set getTrace(), because may be upper limit fact value's section
    'nested array' => [ // output json_encode string
        'key1' => 'value1',
        'key2' => 'value2',
    ],
]);

'channels' => [
    'stack' => [
        'driver' => 'stack',
        'channels' => ['single', 'teams'],
    ],
],

'avatars' => [
    'emergency' => '',
    'alert'     => '',
    'critical'  => '',
    'error'     => '',
    'warning'   => '',
    'notice'    => '',
    'info'      => '',
    'debug'     => '',
],
bash
$ php artisan vendor:publish --provider="Kroyeeg\LaravelTeamsLogging\LoggerServiceProvider"