This repository has been archived on 2026-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
xiv_csolver/python/src/ffcraft_solver/modules/log.py

26 lines
654 B
Python

from datetime import datetime
class Loggers:
def __init__(self):
timestamp = self.get_timestamp()
self.log = f"{timestamp} Log initialised."
def add_log(self, other: str) -> str:
timestamp = self.get_timestamp()
self.log += '\n' + timestamp + ' ' + other
print(self.log)
return self.log
# noinspection PyMethodMayBeStatic
def get_timestamp(self) -> str:
now = datetime.now()
almost_timestamp = str(now.time())
timestamp = almost_timestamp.rsplit('.')
return f'[{timestamp[0]}]'
if __name__ == "__main__":
loggers = Loggers()
print(loggers.log)