1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

Added to "use" log the serviceName & the pool name

This commit is contained in:
Adolfo Gómez García 2018-03-02 18:09:12 +01:00
parent 4271be9340
commit 7320ba0e6d
2 changed files with 7 additions and 4 deletions

View File

@ -209,7 +209,7 @@ class OSManager(Module):
log.doLog(userService, log.INFO, "User {0} has logged in".format(userName), log.OSMANAGER)
log.useLog('login', uniqueId, serviceIp, userName, knownUserIP, fullUserName)
log.useLog('login', uniqueId, serviceIp, userName, knownUserIP, fullUserName, userService.friendly_name, userService.deployed_service.name)
counter = int(userService.getProperty('loginsCounter', '0')) + 1
userService.setProperty('loginsCounter', six.text_type(counter))
@ -255,7 +255,7 @@ class OSManager(Module):
log.doLog(userService, log.INFO, "User {0} has logged out".format(userName), log.OSMANAGER)
log.useLog('logout', uniqueId, serviceIp, userName, knownUserIP, fullUserName)
log.useLog('logout', uniqueId, serviceIp, userName, knownUserIP, fullUserName, userService.friendly_name, userService.deployed_service.name)
if save:
userService.save()

View File

@ -73,7 +73,7 @@ def logStrFromLevel(level):
return __valueLevels.get(level, 'OTHER')
def useLog(type_, serviceUniqueId, serviceIp, username, srcIP=None, srcUser=None):
def useLog(type_, serviceUniqueId, serviceIp, username, srcIP=None, srcUser=None, userServiceName=None, poolName=None):
'''
Logs an "use service" event (logged from actors)
:param type_: Type of event (commonly 'login' or 'logout' )
@ -85,7 +85,10 @@ def useLog(type_, serviceUniqueId, serviceIp, username, srcIP=None, srcUser=None
'''
srcIP = 'unknown' if srcIP is None else srcIP
srcUser = 'unknown' if srcUser is None else srcUser
useLogger.info('|'.join([type_, serviceUniqueId, serviceIp, srcIP, srcUser, username]))
userServiceName = 'unknown' if userServiceName is None else userServiceName
poolName = 'unknown' if poolName is None else poolName
useLogger.info('|'.join([type_, serviceUniqueId, serviceIp, srcIP, srcUser, username, userServiceName, poolName]))
def doLog(wichObject, level, message, source=UNKNOWN, avoidDuplicates=True):