ARCANEDEV / LogViewer

:page_with_curl: Provides a log viewer for Laravel
MIT License
2.37k stars 335 forks source link

how to have my own views? #8

Closed lorvent closed 9 years ago

lorvent commented 9 years ago

any config option not to load pre-included views? because i want to use my own views (if possible controller, model aswell)

please look at laravel-messenger they provide same model,view,controller its upto the user to user them or not.

its great package but most of the sites already will have an admin panel, so we should be able to integrate into it.

arcanedev-maroc commented 9 years ago

@lorvent Of course you can, this package is actually an API, i made routes, controller and views for demostration/test/dev.

To disable the package's views, controller, routes ...

// config/log-viewer.php
<?php

return [
    // other stuff
    /* ------------------------------------------------------------------------------------------------
     |  Route
     | ------------------------------------------------------------------------------------------------
     */
    'route'         => [
        'enabled'    => false,   // Set this to false to diable routes => controller => views

        'attributes' => [
            'prefix'     => 'log-viewer',

            'middleware' => null,
        ],
    ],
    // other stuff
];

Then can create your own routes, controllers and views.

And for the best part, use the API by using the Facade LogViewer already registered by the service provider or the helper log_viewer().

For the API documentation (WIP), you can visit the wiki page for usage examples (https://github.com/ARCANEDEV/LogViewer/wiki/4.-Usage).

There is no models (no database), only entities (Classes/Objects).

You can retrieve them and do you own calculation/transformation.

Note : Take a look at the entities source code (https://github.com/ARCANEDEV/LogViewer/tree/master/src/Entities)

lorvent commented 9 years ago

WOW, I assumed, setting route enabled to false disables only route but you did great job

on a side note, i have an existing site for many months and my log size is very big but when i try to access, its showing just empty dashboard and empty logs list.

what could be the reason?

arcanedev-maroc commented 9 years ago

Do you have only one log file ??

Check your config\app.php :

    /* ---------------------------------------------------------------------
     |  Logging Configuration
     | ---------------------------------------------------------------------
     | Available Settings: "single", "daily", "syslog", "errorlog"
     */
    'log' => 'daily',

The LogViewer support only the daily log system (at this moment) because it's the best way to manage you logs (Smaller size files, delete unnecessary/old logs and more).

If you keep to log into one file, you are going to have a file bigger than 2Go after a year or 2 :).

The solution is to split your log laravel.log into seperate logs:

laravel-YYYY-MM-DD.log
laravel-2015-01-01.log
laravel-2015-01-02.log
laravel-2015-01-03.log
laravel-2015-01-04.log
laravel-2015-01-05.log
lorvent commented 9 years ago

Huh... you are correct i have only single log file but i should blame laravel for it :p default configuration is single and i didn't touch it yet,

now i changed it to daily and wrote some logs.... its showing chart, data beautifully now :)

any chance of allowing single log in future? (just a backward compatibility)

arcanedev-maroc commented 9 years ago

I don't know, it may cause some performance issues, risky (if you delete you log file, you lose all your data), do.....wn......loa..d...v..e..r...y..sl...o....................and you lose your internet connection at 99%

I'm not sure if it's a good idea.

lorvent commented 9 years ago

hahaha makes sense

but how about showing a warning to user if they have single type and guiding them how to make it daily type ?

arcanedev-maroc commented 9 years ago

I'm working on it, i've a lot of ideas for this package. Stay tuned :+1: