I ended up doing this as a proof of concept:
< in *gluon.main.serve_controller()* >

    user = ''
    sessionDict = dict(session)
    if sessionDict.has_key('auth') and sessionDict['auth']:
        authDict = dict(sessionDict['auth'])
        if authDict.has_key('user') and authDict['user']:
            userDict = dict(authDict['user'])
            if userDict.has_key('first_name') and userDict.has_key(
'last_name'):
                user = userDict['first_name'] + ' ' + userDict['last_name']

    def getBody(obj):
        body = None
        try:
            body = obj.getvalue()
        except:
            try:
                body = obj.read()
            except:
                pass

        return body


    logMessage = dict(user=user,
                      controller=request.controller,
                      function=request.function,
                      args=request.args,
                      vars=dict(request.vars),
                      requestBody=getBody(request.body),
                      responseBody=getBody(response.body))
    print logMessage

There must be better ways of doing things - how could I improve this?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to