all repos — listfix @ ab1a175e3797521ad31d1856bb1b9b425af4f505

Postfix Mailing List Software; Maintained on behalf the of Agency Economy Incorporated NFP.

Pass log path in as object param.

	modified:   .gitignore
	modified:   listfix.py
	modified:   listfix/log.py
Brian Barto bartobrian@gmail.com
Wed, 06 Apr 2022 14:12:14 -0400
commit

ab1a175e3797521ad31d1856bb1b9b425af4f505

parent

d0bca2d845a0d19fb5fb9f9a703550de0775a5cc

3 files changed, 7 insertions(+), 5 deletions(-)

jump to
M .gitignore.gitignore

@@ -1,3 +1,4 @@

listfix.sqlite3 +listfix.log tmp __pycache__
M listfix.pylistfix.py

@@ -4,9 +4,11 @@ import sys

import os from listfix import Args, DB, Email, Errors, Log, Test +listfix_dir = os.path.dirname(os.path.realpath(__file__)) + ## Get log object -log = Log() +log = Log(listfix_dir + "/listfix.log") ## Set up the exception handler

@@ -15,7 +17,6 @@ er.set_exception_handler()

## Connect to DB (create DB if needed) and check tables. -listfix_dir = os.path.dirname(os.path.realpath(__file__)) db = DB(listfix_dir + "/listfix.sqlite3") ## Get args
M listfix/log.pylistfix/log.py

@@ -2,13 +2,13 @@ from datetime import datetime

class Log: - def __init__(self): - self.log_file = "/tmp/listfix_log.txt" + def __init__(self, path): + self.path = path def write(self, type, txt): txt = txt.rstrip() date = datetime.now() - f = open(self.log_file, "a") + f = open(self.path, "a") f.write(f"[{type}] {date}, {txt}\n") f.close()