Skip to content

Commit 83b10b4

Browse files
committed
BE: Removal of stdout.log
1 parent 76e7cc7 commit 83b10b4

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

front/plugins/maintenance/maintenance.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def main():
4040
# Check if set
4141
if MAINT_LOG_LENGTH != 0:
4242

43-
MAX_TAIL_SIZE = 0.1 * 1024 * 1024 # 0.1 MB
43+
MAX_TAIL_SIZE = MAINT_LOG_LENGTH * 80 # Bytes = lines * approx 80 chars per log line
4444

4545
for fileEntry in logFiles:
4646

@@ -56,14 +56,10 @@ def main():
5656

5757
try:
5858

59-
if size_before > MAX_TAIL_SIZE:
60-
61-
mylog('verbose', [f'[{pluginName}] {fileEntry} exceeds {MAX_TAIL_SIZE} bytes, truncating'])
62-
63-
with open(logFile, 'r+b') as f:
64-
f.truncate(0)
65-
59+
if size_before <= MAX_TAIL_SIZE:
60+
mylog('verbose', [f'[{pluginName}] {fileEntry} already within limit, skipping'])
6661
else:
62+
mylog('verbose', [f'[{pluginName}] {fileEntry} exceeds limit, trimming to last {MAINT_LOG_LENGTH} lines'])
6763

6864
lines_to_keep = tail_file(logFile, MAINT_LOG_LENGTH)
6965

0 commit comments

Comments
 (0)