Source

django-ucsvlog / djucsvlog / fields / exception_info.py

Full commit
from ucsvlog.utils import unicoder 

def estr(exception):
    return unicoder(exception)

def etype(exception):
    return unicoder(type(exception))

def sfunction(frame,exR):
    return unicoder(frame['function'])

def sfilename(frame,exR):
    return frame['filename']

def slineno(frame,exR):
    return unicoder(frame['lineno'])

def scontext_line(frame,exR):
    return frame['context_line']

def unicoder_truncate(var,length):
    
    value = unicoder(var)
    if len(value)>length:
        return value[0:length]+'...'
    return value

def svars(frame,exR):
    import djucsvlog.settings as my_settings
    vars = frame['vars']
    ret = ''
    for v in vars:
        ret += ' - %s:%s\n' %(v[0],unicoder_truncate(v[1],my_settings.EXCEPTION_VARS_MAX_LENGTH))
    return ret

def emeta(exception,exR):
    return 'meta'