Git Product home page Git Product logo

eloquent-log-driver's Introduction

Eloquent Log Driver

Latest Version on Packagist Software License Quality Score Total Downloads

A Laravel Log Driver for Eloquent

Installation

Via Composer

$ composer require juststeveking/eloquent-log-driver

After installation, publish the migrations using:

Then we can run our migration, which will create a table called database_logs.

$ php artisan migrate

Registering the driver with Laravel

In your .env file add the following:

LOG_CHANNEL=eloquent

Then add the following to your config/logging.php file under channels:

'eloquent' => [
    'driver' => 'custom',
    'via' => \JustSteveKing\EloquentLogDriver\Logger\EloquentLogger::class
]

That is it! Your logs will now automatically start appearing in the database.

Querying Logs

There is a small selection of helper scope available on the DatabaseLog model:

  • whereDebug()
  • whereInfo()
  • whereNotice()
  • whereWarning()
  • whereError()
  • whereCritical()
  • whereAlert()
  • whereEmergency()
  • whereLevel('log-level-case-insensitive')

All of the above will return an instance of an Eloquent Builder, allowing you to chain on further query parameters.

Testing

$ composer run test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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

eloquent-log-driver's People

Contributors

jamie-accessfertility avatar juststeveking avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

eloquent-log-driver's Issues

Typo in formatter

You have a typo in Formatter. There's $filles instead of $fills in 50-ths string

Composer 2.0 PSR-4 compatability

Running composer install/update while running composer ^2.0 and package version ^1.0 will cause:

Class JustSteveKing\EloquentLogDriver\Src\Loggers\EloquentLogger located in /vendor/juststeveking/eloquent-log-driver/src\Loggers\EloquentLogger.php does not comply with psr-4 autoloading standard. Skipping.

Updating the namespace within that class from -
namespace JustSteveKing\EloquentLogDriver\Logger;

to

namespace JustSteveKing\EloquentLogDriver\Loggers; will fix the issue.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.