<commit_before># Loggly Helpers

This extends the basic loggly handler provided by monolog, adding the following information as context:
- the environment
- whether the log happened on a request, or CLI call
- information about the http request (url, method)
- information about the origin of the log call (file and line, class and method (if relevant))
- some simplified exception information (if the log comes from a "normal" exception log - ie. logging, or `__toString`-ing the exception)

Note: there is currently a bug with the class and method origin / backtrace information.

### Installation

```bash
composer require golin/monologgly
```

### Setup with Laravel

##### Config

Add the following to `config/app.php`:

```php
    'loggly-token' => env('LOGGLY_TOKEN'),
```

and add your loggly token to your .env file. Ommitting this will mean that the loggly monlog handler will not be loaded (and nothing will be sent to loggly) - basically, it's safe to not have this key when developing locally.

##### Provider

Add the following file, as `LogglyServiceProvider.php`, and put it in your application's service providers config in `config/app.php`.

Update the `$name` property with your application's name.

```php
<?php

namespace App\Providers;

use Golin\MonoLoggly\LogglyServiceProvider as BaseProvider;
use Monolog\Monolog;

class LogglyServiceProvider extends BaseProvider {

    /**
     * The log name. This should uniquely identify the log.<commit_msg>add infromation about logging<commit_after># Loggly Helpers

This extends the basic loggly handler provided by monolog, adding the following information as context:
- the environment
- whether the log happened on a request, or CLI call
- information about the http request (url, method)
- information about the origin of the log call (file and line, class and method (if relevant))
- some simplified exception information (if the log comes from a "normal" exception log - ie. logging, or `__toString`-ing the exception)

Note: there is currently a bug with the class and method origin / backtrace information.

### Installation

```bash
composer require golin/monologgly
```

### Exceptions

To log exception information, simply add the exception to the context:

```php
$logger->debug('Oh No!', ['exception' => $e]);
```

The exception object will be removed before final logging, and replaced with an array interpretation of it. It will still be available to all other processors added (as long as they are added before the exception information processor (which they will be using the provided service provider)).

### Setup with Laravel

##### Config

Add the following to `config/app.php`:

```php
    'loggly-token' => env('LOGGLY_TOKEN'),
```

and add your loggly token to your .env file. Ommitting this will mean that the loggly monlog handler will not be loaded (and nothing will be sent to loggly) - basically, it's safe to not have this key when developing locally.

##### Provider

Add the following file, as `LogglyServiceProvider.php`, and put it in your application's service providers config in `config/app.php`.

Update the `$name` property with your application's name.

```php
<?php

namespace App\Providers;

use Golin\MonoLoggly\LogglyServiceProvider as BaseProvider;
use Monolog\Monolog;

class LogglyServiceProvider extends BaseProvider {

    /**
     * The log name. This should uniquely identify the log.
{'fraction_non_alphanumeric': 0.08083480305702528, 'fraction_numerical': 0.0, 'mean_word_length': 4.52435064935065, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3537729', 'n_tokens_mistral': 909, 'n_tokens_neox': 873, 'n_words': 450}