X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=activity%2F__init__.py;h=4719a61cd800694bd3140aba21728e9608f5d67c;hb=485d5ae5ddd76213a6ba7d80a7a6d5048786b804;hp=6157bae7c10456dd0f6a32f6c607d58578925671;hpb=25a564caae591fd408aa0c11470e99852306f20d;p=unfold.git diff --git a/activity/__init__.py b/activity/__init__.py index 6157bae7..4719a61c 100644 --- a/activity/__init__.py +++ b/activity/__init__.py @@ -56,21 +56,25 @@ def logWrite(request, action, message, objects = None): "apikey" : apikey, "signature" : sign(secret, "%s%s%s%s" % (timestamp, ip, request.user, action)), "slice" : None, - "resource" : None + "resource" : None, + "resource_type" : None, + "facility" : None, + "testbed" : None, } - if objects and 'slice' in objects : - log['slice'] = objects['slice'] - - if objects and 'resource' in objects : - log['resource'] = objects['resource'] + if objects is not None: + for o in objects : + if (o in log) : + log[o] = objects[o] try : result = urllib2.urlopen(server, urllib.urlencode(log)) - print "===============>> activity: " + action + " <" + request.user + "> " + message + print "===============>> activity: %s <%s> %s" % (action, request.user,message) content = result.read() except urllib2.URLError as e: print "===============>> activity: connection to " + server + " impossible, could not log action" + print e.strerror + print "" def log(request, action, message, objects = None): # Create a new thread in Daemon mode to send the log entry