prepared logger task for file rotation
This commit is contained in:
parent
e5b0c9b414
commit
ee1b22ad66
1 changed files with 7 additions and 3 deletions
|
|
@ -32,16 +32,20 @@ class LoggerTask(Task):
|
||||||
|
|
||||||
args = self.get_arguments()
|
args = self.get_arguments()
|
||||||
|
|
||||||
|
if "directory" in args:
|
||||||
|
self.directory = args["directory"]
|
||||||
|
else:
|
||||||
|
raise Exception("There is no directory set")
|
||||||
|
|
||||||
|
self.file = "data.log"
|
||||||
if "file" in args:
|
if "file" in args:
|
||||||
self.file = args["file"]
|
self.file = args["file"]
|
||||||
else:
|
|
||||||
raise Exception("There is no file set")
|
|
||||||
|
|
||||||
def needs_arguments(self):
|
def needs_arguments(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def execute(self, job_information):
|
def execute(self, job_information):
|
||||||
f = open(self.file, 'a')
|
f = open(self.directory + self.file, 'a')
|
||||||
f.write(job_information.get_response_message() + '\n')
|
f.write(job_information.get_response_message() + '\n')
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue