mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
Fix of the log rotation att 1
This commit is contained in:
@@ -663,6 +663,7 @@ async def check_data():
|
||||
)
|
||||
async with channel.typing():
|
||||
path_newfile = f"{LOGSTORE}{MEMORY_FIVE_MUZYKA[:-4]}{datetime.now()}.json"
|
||||
logger.info(path_newfile)
|
||||
with open(MEMORY_FIVE_MUZYKA, "r+", encoding=ENCODING) as file_music_memory:
|
||||
with open(path_newfile, "x", encoding=ENCODING) as new_file:
|
||||
# First we load existing data into a dict.
|
||||
@@ -670,6 +671,7 @@ async def check_data():
|
||||
new_data = []
|
||||
new_data.append(file_data[0])
|
||||
new_data.extend(file_data[:-20])
|
||||
file_music_memory.truncate(0)
|
||||
file_music_memory.seek(0)
|
||||
# convert back to json.
|
||||
new_file.seek(0)
|
||||
@@ -680,6 +682,7 @@ async def check_data():
|
||||
)
|
||||
if os.path.getsize(MEMORY_FIVE_SIARA) > 300000:
|
||||
path_newfile = "{LOGSTORE}{MEMORY_FIVE_SIARA[:-4]}{datetime.now()}.json"
|
||||
logger.info(path_newfile)
|
||||
await channel.send(
|
||||
"*Conjurer porządkuje bar, ścina lekkim laserem pulsacyjnym powierzchnie baru o grubości kilku mikronów i ogólnie wygląda na zajętego....*"
|
||||
)
|
||||
@@ -690,6 +693,7 @@ async def check_data():
|
||||
new_data = []
|
||||
new_data.append(file_data[0])
|
||||
new_data.extend(file_data[:-20])
|
||||
file.truncate(0)
|
||||
file.seek(0)
|
||||
new_file.seek(0)
|
||||
# convert back to json.
|
||||
|
||||
Reference in New Issue
Block a user