crcms/logger

Mongodb log extension based on laravel logs.

0.1.0 2019-03-05 10:15 UTC

This package is auto-updated.

Last update: 2024-11-07 04:22:21 UTC


README

Latest Stable Version License StyleCI

Mongodb log extension based on laravel logs

Install

composer require crcms/logger

Config

Modify the following two configuration files

config/logging.php

use CrCms\Log\MongoDBLogger;

'channels' => [
    'mongo' => [
        'driver' => 'custom',
        // If it is empty, the default app.env
        //'name' => env('APP_ENV', 'production'),
        'via' => MongoDBLogger::class,
        'level' => 'debug',
        'database' => [
            'driver' => 'mongodb',
            // If it is empty, the default database will be selected.
            'database' => 'logger',
            'collection' => 'logger',
        ],
    ],
]

config/database.php

'connections' => [
    'mongodb' => [
        'driver' => 'mongodb',
        'host' => env('DB_MONGO_HOST', 'localhost'),
        'port' => env('DB_MONGO_PORT', 27017),
        'database' => env('DB_MONGO_DATABASE'),
        'username' => env('DB_MONGO_USERNAME'),
        'password' => env('DB_MONGO_PASSWORD'),
        'options' => [
            'database' => env('DB_MONGO_AUTH_DATABASE', 'admin')
        ]
    ],
]