예제 #1
0
def debug(value, console=True):
    if not hasattr(settings, "DEBUG") or settings.DEBUG is False:
        return
    stack = inspect.stack()[1]
    frm = stack[0]
    print frm.f_locals
    record = DebugRecord()
    record.globals = frm.f_globals
    record.locals = frm.f_locals
    record.value = str(value)
    record.invoked = {}
    record.invoked["file"] = stack[1]
    record.invoked["line"] = stack[2]
    record.invoked["function"] = stack[3]

    if inspect.isclass(value):
        debug_class(value, record)
    elif inspect.ismodule(value):
        debug_module(value, record)
    else:
        debug_default(value, record)

    record.dir = dir(record)
    log_record(record)
    if console:
        console_debug(record)
예제 #2
0
def debug(value, console=True):
    if not hasattr(settings, 'DEBUG') or settings.DEBUG is False:
        return
    stack = inspect.stack()[1]
    frm = stack[0]
    print frm.f_locals
    record = DebugRecord()
    record.globals = frm.f_globals
    record.locals = frm.f_locals
    record.value = str(value)
    record.invoked = {}
    record.invoked['file'] = stack[1]
    record.invoked['line'] = stack[2]
    record.invoked['function'] = stack[3]

    if inspect.isclass(value):
        debug_class(value, record)
    elif inspect.ismodule(value):
        debug_module(value, record)
    else:
        debug_default(value, record)

    record.dir = dir(record)
    log_record(record)
    if console:
        console_debug(record)
예제 #3
0
def debug(value, console=True):
    stack = inspect.stack()[1]
    frm = stack[0]

    record = DebugRecord()
    record.globals = frm.f_globals
    record.locals = frm.f_locals
    record.value = str(value)
    record.invoked = {}
    record.invoked['file'] = stack[1]
    record.invoked['line'] = stack[2]
    record.invoked['function'] = stack[3]

    if inspect.isclass(value):
        debug_class(value, record)
    elif inspect.ismodule(value):
        debug_module(value, record)
    else:
        debug_default(value, record)

    record.dir = dir(record)
    log_record(record)
    if console:
        console_debug(record)