pretty job string function for lish, fixed logging
TODO: set Logging levels
This commit is contained in:
parent
157de0cbd4
commit
0bfb8ef3ae
4 changed files with 22 additions and 6 deletions
|
|
@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from binascii import crc32
|
||||
|
||||
|
||||
def generateId():
|
||||
|
|
@ -43,9 +44,22 @@ class Job:
|
|||
def __str__(self):
|
||||
return str(self.__dict__)
|
||||
|
||||
|
||||
def __hex__(self):
|
||||
return hex(crc32(str(self.service) + str(self.host) + str(self.members)))
|
||||
|
||||
def set_logger(self, log):
|
||||
self.log = log
|
||||
|
||||
|
||||
|
||||
def pretty_string(self):
|
||||
ret = self.__hex__()
|
||||
if ret[0] == "-":
|
||||
ret = ret[1:]
|
||||
ret += ": (" + str(self.host) + str(self.service) + str(self.job) + ")"
|
||||
return ret[2:]
|
||||
|
||||
def set_job(self, job):
|
||||
self.job = job
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue