""" /************************************************************************* * * CONFIDENTIAL * __________________ * * Copyright (2024-2025) AI Labs, IronOne Technologies, LLC * All Rights Reserved * * Author : Theekshana Samaradiwakara * Description : This file contains the application logging logic. * CreatedDate : 14/10/2024 * LastModifiedDate : *************************************************************************/ """ ''' TO DO : Implement the api endpoint router seperately ''' import datetime import logging import os import pytz def filer(): """ Returns the log file path based on the current date and ensures the directory exists. """ colombo_tz = pytz.timezone('Asia/Colombo') today = datetime.datetime.now(colombo_tz) # log_dir = "logs"#for local log_dir = "usr/app/logs"#for docker if not os.path.exists(log_dir): os.makedirs(log_dir) log_filename = f"{log_dir}/{today.year}-{today.month:02d}-{today.day:02d}.log" print("logged",log_filename) return log_filename file_handler = logging.FileHandler(filer()) file_handler.setLevel(logging.INFO) logging.basicConfig( level=logging.DEBUG, format="%(asctime)s %(levelname)s (%(name)s) : %(message)s", datefmt="%Y-%m-%d %H:%M:%S", handlers=[file_handler], force=True, ) logger = logging.getLogger(__name__)