forked from shaba/openuds
* Added Log lovel str as constants
* Updated so services are keeped at least 10 after marked for removal * Update os manager so it logs user in/out events (probably will remove this after testing log from actor directly...)
This commit is contained in:
parent
c1dd63a7a7
commit
2af9e04343
@ -41,14 +41,16 @@ OTHER,DEBUG,INFO,WARN,ERROR,FATAL = (10000*(x+1) for x in xrange(6))
|
||||
# Logging sources
|
||||
INTERNAL,ACTOR,TRANSPORT = ('internal', 'actor', 'transport')
|
||||
|
||||
OTHERSTR,DEBUGSTR,INFOSTR,WARNSTR,ERRORSTR,FATALSTR = ('OTHER', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL')
|
||||
|
||||
# Names for defined log levels
|
||||
__nameLevels = {
|
||||
'DEBUG': DEBUG,
|
||||
'INFO': INFO,
|
||||
'WARN': WARN,
|
||||
'ERROR': ERROR,
|
||||
'FATAL': FATAL,
|
||||
'OTHER': OTHER
|
||||
DEBUGSTR: DEBUG,
|
||||
INFOSTR: INFO,
|
||||
WARNSTR: WARN,
|
||||
ERRORSTR: ERROR,
|
||||
FATALSTR: FATAL,
|
||||
OTHERSTR: OTHER
|
||||
}
|
||||
|
||||
# Reverse dict of names
|
||||
|
@ -57,6 +57,7 @@ class UserServiceInfoItemsCleaner(Job):
|
||||
@transaction.commit_on_success
|
||||
def run(self):
|
||||
removeFrom = getSqlDatetime() - timedelta(seconds = GlobalConfig.KEEP_INFO_TIME.getInt())
|
||||
logger.debug('Removing information user services from {0}'.format(removeFrom))
|
||||
UserService.objects.select_for_update().filter(state__in=State.INFO_STATES, state_date__lt=removeFrom).delete()
|
||||
|
||||
|
||||
|
@ -123,6 +123,7 @@ class WindowsOsManager(osmanagers.OSManager):
|
||||
si = service.getInstance()
|
||||
si.userLoggedIn(data)
|
||||
service.updateData(si)
|
||||
self.doLog(service, 'User {0} has logged IN\t{1}'.format(data, log.INFOSTR))
|
||||
# We get the service logged hostname & ip and returns this
|
||||
ip, hostname = service.getConnectionSource()
|
||||
ret = "{0}\t{1}".format(ip, hostname)
|
||||
@ -131,6 +132,7 @@ class WindowsOsManager(osmanagers.OSManager):
|
||||
si = service.getInstance()
|
||||
si.userLoggedOut(data)
|
||||
service.updateData(si)
|
||||
self.doLog(service, 'User {0} has logged OUT\t{1}'.format(data, log.INFOSTR))
|
||||
if self._onLogout == 'remove':
|
||||
doRemove = True
|
||||
elif msg == "ip":
|
||||
|
Loading…
Reference in New Issue
Block a user