added timestamp to each message in logger task
This commit is contained in:
parent
4577608b81
commit
e675d4be27
1 changed files with 3 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import datetime
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
|
|
||||||
from linspector.tasks.task import Task
|
from linspector.tasks.task import Task
|
||||||
|
|
@ -45,8 +46,9 @@ class LoggerTask(Task):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def execute(self, job_information):
|
def execute(self, job_information):
|
||||||
|
now = datetime.datetime.now().strftime("%Y.%m.%d %H:%M:%S")
|
||||||
f = open(self.directory + self.file, 'a')
|
f = open(self.directory + self.file, 'a')
|
||||||
f.write(job_information.get_response_message() + '\n')
|
f.write(now + ': ' + job_information.get_response_message() + '\n')
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue