INNER CODE UNIT · Python
format
aiplanethub/openagi · src/openagi/__init__.py:17
def format(self, record):
log_color = self.COLORS.get(record.levelno, self.RESET)
log_fmt = f"{log_color}%(asctime)s :%(funcName)s: %(message)s{self.RESET}"
formatter = logging.Formatter(log_fmt, datefmt="%Y-%m-%d %H:%M:%S")
return formatter.format(record)
BASE_PATH = "logs"
pth = Path(BASE_PATH)
pth.mkdir(parents=True, exist_ok=True)
filename = f'{pth.absolute()}/application_{datetime.now().strftime("%Y-%m-%d_%H-%M-%S")}.log'
LOG_LEVEL = getattr(
logging,
os.environ.get("OPENAGI_LOG_LEVEL", "INFO").upper(),
logging.INFO,
)