Closed vikramsubramanian closed 2 weeks ago
To address the issue of changing the log file naming format, follow these actionable steps:
generate_rename_path
function in loguru/_file_sink.py
to generate filenames in the new format:def generate_rename_path(root, ext, creation_time):
creation_datetime = datetime.datetime.fromtimestamp(creation_time)
date = FileDateFormatter(creation_datetime)
renamed_path = "{}.password{}".format(date, ext)
counter = 1
while os.path.exists(renamed_path):
counter += 1
renamed_path = "{}.password.{}{}".format(date, counter, ext)
return renamed_path
generate_rename_path
function by checking and updating the relevant parts of the code where this function is called, such as in _terminate_file
and _create_path
methods. For example:# In _terminate_file method
def _terminate_file(self):
...
new_path = generate_rename_path(root, ext, creation_time)
...
# In _create_path method
def _create_path(self):
...
new_path = generate_rename_path(root, ext, creation_time)
...
By following these steps, the log file naming format will be updated to {date_time}.password.log
, ensuring consistency with the new naming convention.
💡 To rerun Mayil, comment mayil-ai rerun
. Mayil will incorporate any new context added to the ticket. Include details in your rerun comment to guide Mayil!
hi all,
as you can see from the link image below
it saves it as
password.{date_time_number}.log
i want to change the syntax to
{date_time}.password.log
is this possible please
thanks, rob )