GithubHelp home page GithubHelp logo

laravel-command-logger's Introduction

Deprecation notice

We are no longer using this package in favor of https://github.com/spatie/laravel-schedule-monitor and Oh Dear (https://ohdear.app/).

Log commands with their execution time

Latest Version on Packagist

Log the start and finish of all commands, along with their execution time. This is especially useful to detect if scheduled commands (for instance every night) run for longer than expected.

Installation

You can install the package via composer:

composer require teachiq/laravel-command-logger

Usage

The package auto-registers. The log is saved by default to storage/logs/command.log.

[2020-06-07 10:30:14] environment.DEBUG: Starting route:list at 2020-06-07 10:30:14  
[2020-06-07 10:30:14] environment.DEBUG: Finished route:list at 2020-06-07 10:30:14 (0.34346413612366 seconds)  
[2020-06-07 10:36:25] environment.DEBUG: Starting exam:move-teacher at 2020-06-09 07:36:25  
[2020-06-07 10:36:25] environment.DEBUG: __SLOW__ Finished exam:move-teacher at 2020-06-09 07:36:25 (18.763263940811 seconds)  

You can configure the pagage by overriding the values in config/command-log.php if you want. The default values are the following:

<?php

return [
    // The log channel where the logs are written
    'channel' => [
        'driver' => 'single',
        'path' => storage_path('logs/command.log'),
        'level' => 'debug',
    ],
    // Specify any specific commands that should be excluded from logging
    'exclude' => [
        'config:cache',
        'route:cache',
    ],
    // Exeuctions longer than this value (in seconds) will be marked with __SLOW__ in the log
    'slow' => 5,
];

Testing

composer test

Contributing

Please see CONTRIBUTING for details.

Security

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

License

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

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

laravel-command-logger's People

Contributors

krisell avatar pelmered avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

pelmered ianhomew

laravel-command-logger's Issues

Avoid config:cache and route:cache or solve config clearing issue

The log channel command can't be found in the finished listener for config:cache and route:cache. The reason is that these clear and rebuild the config. This can be solved either by simply avoiding logging these two commands, or by setting the config in the finished listener again.

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.