Mayil-AI-Sandbox / loguru-Jan2023

MIT License
0 stars 0 forks source link

file logs change format (hashtag1180) #147

Closed vikramsubramanian closed 2 weeks ago

vikramsubramanian commented 2 weeks ago

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 )

mayil-ai[bot] commented 2 weeks ago

Some past issues to consider:

Here are some code snippets that may help you get started:

To address the issue of changing the log file naming format, follow these actionable steps:

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
# 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!