Skip to content

Commit

Permalink
Use logging.info to handle -ts switch properly (#1884)
Browse files Browse the repository at this point in the history
Co-authored-by: laxa <[email protected]>
  • Loading branch information
laxaa and laxa authored Feb 6, 2025
1 parent 0f4b866 commit 075f2b1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions examples/netview.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,11 @@ def getSessions(self, target):
# Are we filtering users?
if self.__filterUsers is not None:
if userName in self.__filterUsers:
print("%s: user %s logged from host %s - active: %d, idle: %d" % (
logging.info("%s: user %s logged from host %s - active: %d, idle: %d" % (
target, userName, sourceIP, session['sesi10_time'], session['sesi10_idle_time']))
printCRLF = True
else:
print("%s: user %s logged from host %s - active: %d, idle: %d" % (
logging.info("%s: user %s logged from host %s - active: %d, idle: %d" % (
target, userName, sourceIP, session['sesi10_time'], session['sesi10_idle_time']))
printCRLF = True

Expand All @@ -343,10 +343,10 @@ def getSessions(self, target):
# Are we filtering users?
if self.__filterUsers is not None:
if userName in self.__filterUsers:
print("%s: user %s logged off from host %s" % (target, userName, sourceIP))
logging.info("%s: user %s logged off from host %s" % (target, userName, sourceIP))
printCRLF=True
else:
print("%s: user %s logged off from host %s" % (target, userName, sourceIP))
logging.info("%s: user %s logged off from host %s" % (target, userName, sourceIP))
printCRLF=True

if printCRLF is True:
Expand Down Expand Up @@ -409,10 +409,10 @@ def getLoggedIn(self, target):
# Are we filtering users?
if self.__filterUsers is not None:
if userName in self.__filterUsers:
print("%s: user %s\\%s logged in LOCALLY" % (target,logonDomain,userName))
logging.info("%s: user %s\\%s logged in LOCALLY" % (target,logonDomain,userName))
printCRLF=True
else:
print("%s: user %s\\%s logged in LOCALLY" % (target,logonDomain,userName))
logging.info("%s: user %s\\%s logged in LOCALLY" % (target,logonDomain,userName))
printCRLF=True

# Let's see who logged out since last check
Expand All @@ -423,10 +423,10 @@ def getLoggedIn(self, target):
# Are we filtering users?
if self.__filterUsers is not None:
if userName in self.__filterUsers:
print("%s: user %s\\%s logged off LOCALLY" % (target,logonDomain,userName))
logging.info("%s: user %s\\%s logged off LOCALLY" % (target,logonDomain,userName))
printCRLF=True
else:
print("%s: user %s\\%s logged off LOCALLY" % (target,logonDomain,userName))
logging.info("%s: user %s\\%s logged off LOCALLY" % (target,logonDomain,userName))
printCRLF=True

if printCRLF is True:
Expand Down

0 comments on commit 075f2b1

Please sign in to comment.