20 lines
469 B
Python
20 lines
469 B
Python
from utils import pgclass, dbhelper
|
|
from utils.platform_consts import EVENT_TYPE
|
|
|
|
def logger(type, message):
|
|
table = pgclass.SQLlog
|
|
|
|
flag = False
|
|
for etl in EVENT_TYPE:
|
|
if type in EVENT_TYPE[etl]:
|
|
flag = True
|
|
log = table(source = etl, message = message)
|
|
break
|
|
|
|
# session.add
|
|
if flag:
|
|
with dbhelper.db.getsession() as session:
|
|
session.add(log)
|
|
session.commit()
|
|
|
|
|