Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Dev Debug Log Details »»
Dev Debug Log
Version: 0.2, by sweede sweede is offline
Developer Last Online: Jun 2014 Show Printable Version Email this Page

Category: Mini Mods - Version: 3.7.x Rating:
Released: 04-22-2008 Last Update: 04-22-2008 Installs: 5
DB Changes Uses Plugins
Re-useable Code Additional Files Translations  
No support by the author.

Introduction:
This is my basic logging mechanism used in two of my current vbulletin products.

Instead of writing a text file to the file system which may or may not have been the best thing to do, i instead wrote this small plugin to facilitate logging to a database table instead.

Install:
Upload the contents of the upload folder to your vbulletin root directory.
Install the product XML file.

Usage:
There are no options that need to be set (they should be turned on/off in your plugin code).

Main Class is called DebugLog. It has one class variable, product, and two class methods, set and log.

Log takes up to 4 arguments.
Quote:
log($log, $location = '', $line = '', $extra = '' )
$log is the string, array or object of the data you wish to save.
$location is commonly the function or method that you are logging.
$line is commonly __LINE__ , but in a plugin this may or may not work,
so you can set this number manually if you wish
$extra is extra information about the data you are logging such as "should never be 0"
Set takes two arguments.
Quote:
set($var, $value)
$var is the variable name (currently only product is a valid variable to set).
$value is the value you wish $var to be.
in your plugin, it is advisable to setup your own debug class wrapper around the DevLog class
PHP Code:
class MyClass
{
    var 
$D '';

    function 
SetupLog()
    {
        global 
$vbulletin;
        if(
$vbulletin->options['MyProduct_debug_enable'] && class_exists("DebugLog"))
        {
            
$this->= new DebugLog();
            
$this->D->set("product""MyProduct");
        }
    }

    function 
debug($data,$location='',$line='',$extra='')
    {
        global 
$vbulletin;
        if(
$vbulletin->options['MyProduct_debug_enable'] && class_exists("DebugLog"))
        {
            
$this->D->log($data,$location,$line,$extra);
        }
    }
    function 
MyMethod($bar)
    {
        
$this->debug($bar,"MyMethod");
        echo 
$bar " + foo";
    }
}

$obj = new MyClass;
$obj->SetupLog(); // You need to seed the product so that it logs can be sorted

$obj->debug($obj,"Class Object");
//Writes Class information to the log table.

$var $obj->MyMethod("Frank");
$obj->debug($var,"Called MyMethod");
// Writes the value of $var to the log table 
you can also call the class staticly
PHP Code:
DebugLog::log($var); 
You cannot set the product with this method so it defaults to devlog

Viewing Logs:
Admincp -> Devlog ->View Logs

This is -very very- basic and will gradually be expanded. As it currently is, it will be enough to assist in debugging current problems with my plugins.

ChangeLog
v0.1 - Release
v0.2 - Cosmetic - Added Line numbers to debug log output.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 04-22-2008, 10:06 PM
sweede's Avatar
sweede sweede is offline
 
Join Date: Jan 2007
Posts: 391
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Some images of the AdminCP area
Reply With Quote
  #3  
Old 04-22-2008, 10:13 PM
sweede's Avatar
sweede sweede is offline
 
Join Date: Jan 2007
Posts: 391
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Reserved
Reply With Quote
  #4  
Old 04-23-2008, 02:50 PM
Illidanz Illidanz is offline
 
Join Date: Dec 2005
Location: Italy
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very nice one, really cool

Thanks man

*clicks Install
Reply With Quote
  #5  
Old 04-23-2008, 03:03 PM
sweede's Avatar
sweede sweede is offline
 
Join Date: Jan 2007
Posts: 391
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've found it to be pretty usefull so far. I do regret the names that i chose though.. debuglog::log is kind of.. horrible

Next week i plan on really cracking a peice from the admin log viewer. Currently i added Line Numbering to it, and it looks pretty reasonable.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:29 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06003 seconds
  • Memory Usage 2,253KB
  • Queries Executed 18 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (4)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete