Giter VIP home page Giter VIP logo

kohana-log-viewer's Introduction

Anis Uddin Ahmad - Cover Photo

Hi ๐Ÿ‘‹ - Assalamu'Alaikum (Peace be upon you)!

I am Anis Uddin Ahmad, a software architect with 11+ years of experience in designing and building enterprise applications. I absolutely love programming, from designing system architecture to developing OSS tools for solving granular problems.

Language & Data:

Frameworks & Tools:

Stats:

Anis Uddin Ahmad's GitHub stats Anis Uddin Ahmad's Top Langs

kohana-log-viewer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

kohana-log-viewer's Issues

Use Kohana standards

I suggest you use the Kohana standards of being able to extend classes.

As such you would move the functionality of classes/Controller/Logs.php into classes/Controller/Kohana/Logs.php with the class name Controller_Kohana_Logs, and then classes/Controller/Logs.php a dummy class that extends Controller_Kohana_Logs.

This allows me to simply extend the Controller_Logs class to check with our log in system and privileges.

Uninitialized string offset: 0

Getting another exception on some log-files. Here is the content of one that does:

<?php defined('SYSPATH') or die('No direct script access.'); ?>

2012-04-10 06:30:21 --- ERROR: HTTP_Exception_404 [ 404 ]: The requested URL tag/announcement was not found on this server. ~ SYSPATH/classes/kohana/request/client/internal.php [ 87 ]
2012-04-10 10:50:17 --- ERROR: HTTP_Exception_404 [ 404 ]: The requested URL tag/concert was not found on this server. ~ SYSPATH/classes/kohana/request/client/internal.php [ 87 ]
2012-04-10 16:45:40 --- ERROR: HTTP_Exception_401 [ 401 ]: To access member/password, you need to log in. ~ APPPATH/classes/controller.php [ 56 ]
2012-04-10 16:45:41 --- ERROR: HTTP_Exception_400 [ 400 ]: Unknown or expired reset token. ~ APPPATH/classes/controller/member.php [ 222 ]
2012-04-10 16:46:35 --- ERROR: HTTP_Exception_400 [ 400 ]: Unknown or expired reset token. ~ APPPATH/classes/controller/member.php [ 222 ]
2012-04-10 18:58:28 --- ERROR: HTTP_Exception_401 [ 401 ]: To access song/practice, you need to log in. ~ APPPATH/classes/controller.php [ 56 ]
2012-04-10 19:04:24 --- ERROR: HTTP_Exception_401 [ 401 ]: To access song/practice, you need to log in. ~ APPPATH/classes/controller.php [ 56 ]
2012-04-10 20:14:50 --- ERROR: HTTP_Exception_401 [ 401 ]: To access song/practice, you need to log in. ~ APPPATH/classes/controller.php [ 56 ]
2012-04-10 20:43:22 --- ERROR: HTTP_Exception_401 [ 401 ]: To access member/password, you need to log in. ~ APPPATH/classes/controller.php [ 56 ]
2012-04-10 20:43:22 --- ERROR: HTTP_Exception_400 [ 400 ]: Unknown or expired reset token. ~ APPPATH/classes/controller/member.php [ 222 ]
2012-04-10 20:44:24 --- ERROR: HTTP_Exception_400 [ 400 ]: Unknown or expired reset token. ~ APPPATH/classes/controller/member.php [ 222 ]
2012-04-10 21:32:41 --- ERROR: HTTP_Exception_401 [ 401 ]: To access song/practice, you need to log in. ~ APPPATH/classes/controller.php [ 56 ]
2012-04-10 21:36:19 --- ERROR: ErrorException [ 8 ]: Uninitialized string offset: 0 ~ MODPATH/logviewer/classes/model/logreport.php [ 45 ]
2012-04-10 21:36:27 --- ERROR: ErrorException [ 8 ]: Uninitialized string offset: 0 ~ MODPATH/logviewer/classes/model/logreport.php [ 45 ]
2012-04-10 21:36:44 --- ERROR: ErrorException [ 8 ]: Uninitialized string offset: 0 ~ MODPATH/logviewer/classes/model/logreport.php [ 45 ]
2012-04-10 21:36:51 --- ERROR: ErrorException [ 8 ]: Uninitialized string offset: 0 ~ MODPATH/logviewer/classes/model/logreport.php [ 45 ]

LICENSE

How about add license file to your project? For example MIT license.

Windows PHP Bug #18090 override

In Kohana file you can see a comment:

// Log message levels - Windows users see PHP Bug #18090

That means, that MANY error levels on Win system are not available. But... there are a hack: let's override Log with such file:

<?php defined('SYSPATH') OR die('No direct script access.');
// file: APPPATH/classes/Log.php
class Log extends Kohana_Log {
    const EMERGENCY = 0; 
    const ALERT     = 1; 
    const CRITICAL  = 2;
    const ERROR     = 3;
    const WARNING   = 4;
    const NOTICE    = 5; 
    const INFO      = 6; 
    const DEBUG     = 7;
}

And Kohana_Log_File with such file:

<?php defined('SYSPATH') OR die('No direct script access.');
// file: APPPATH/classes/Log/File.php
class Log_File extends Kohana_Log_File {
    protected $_log_levels = array(
        Log::EMERGENCY   => 'EMERGENCY',
        Log::ALERT   => 'ALERT',
        Log::CRITICAL => 'CRITICAL',
        Log::ERROR     => 'ERROR',
        Log::WARNING => 'WARNING',
        Log::NOTICE  => 'NOTICE',
        Log::INFO    => 'INFO',
        Log::DEBUG   => 'DEBUG',
    );
}

I know, that extending log levels on deeper level may create problems (while using SysLog, which support of log levels is limited), but in file case, obviously, nothing bad can happens. So, this hack works fine for me, but your module cannot be hacked with such method (you didn't follow Kohana convention to name classes in modules with prefix, extending Kohana_Base_Classes and creating dummy class extendor). So, I think, it will be a good idea to replace in your Model_Logreport levels array the same:

// lines skipped
    // Copy of Kohana_log_file log levels
    public static $levels = array(
            Log::EMERGENCY   => 'EMERGENCY',
            Log::ALERT   => 'ALERT',
            Log::CRITICAL => 'CRITICAL',
            Log::ERROR     => 'ERROR',
            Log::WARNING => 'WARNING',
            Log::NOTICE  => 'NOTICE',
            Log::INFO    => 'INFO',
            Log::DEBUG   => 'DEBUG',
        );
// lines skipped

This will work both with hacked Kohana version and with standart Kohana installation.
Good luck!

Crashes if logs directory is empty

I get an exception if the logs directory is empty.

ErrorException [ Notice ]: Undefined variable: months
MODPATH\logviewer\views\logs\monthlist.php [ 5 ]

Fixed it by changing line 5 in monthlist.php and daylist.php to

    <?php if( ! empty($months)) foreach($months as $month): ?>
    <?php if( ! empty($days)) foreach($days as $day): ?>

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.