Update generate_log.py
This commit is contained in:
1 parent
18ca01ed6b
commit
90931b2d75
1 file changed
+22
-7
+22
-7
@@ -21,12 +21,27 @@ log_messages = [
|
|||||||
"System update installed.",
|
"System update installed.",
|
||||||
]
|
]
|
||||||
|
|
||||||
#first 11 in this log file should be extact order in log_messages list and then random from there
|
open(machine_log_file, "w").close()
|
||||||
|
|
||||||
for i in range(num_lines):
|
for i in range(num_lines):
|
||||||
if i < 11:
|
#on all
|
||||||
log_entry = f"[{machine_num}-{i}] [{log_level[i % len(log_level)]}] {log_messages[i]}\n"
|
if i == 0:
|
||||||
else:
|
log_entry = f"[{machine_num}-{i}] [INFO] TEST_ALL\n"
|
||||||
log_entry = f"[{machine_num}-{i}] [{log_level[random.randint(0, len(log_level) - 1)]}] {log_messages[random.randint(0, len(log_messages) - 1)]}\n"
|
#unique
|
||||||
with open(machine_log_file, "a") as file:
|
elif i == 1:
|
||||||
file.write(log_entry)
|
log_entry = f"[{machine_num}-{i}] [DEBUG] TEST_UNIQUE\n"
|
||||||
|
#on some
|
||||||
|
elif i == 2 and machine_num in [1, 3, 5, 7, 9]:
|
||||||
|
log_entry = f"[{machine_num}-{i}] [ERROR] TEST_SOME\n"
|
||||||
|
|
||||||
|
elif 3 <= i < 13:
|
||||||
|
log_entry = f"[{machine_num}-{i}] [INFO] TEST_MEDIUM\n"
|
||||||
|
|
||||||
|
else:
|
||||||
|
log_entry = f"[{machine_num}-{i}] [{random.choice(log_level)}] {random.choice(log_messages)}\n"
|
||||||
|
|
||||||
|
with open(machine_log_file, "a") as f:
|
||||||
|
f.write(log_entry)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in new issue
Block a user