Update generate_log.py
This commit is contained in:
1 parent
18ca01ed6b
commit
90931b2d75
1 file changed
+21
-6
+21
-6
@@ -21,12 +21,27 @@ log_messages = [
|
||||
"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):
|
||||
if i < 11:
|
||||
log_entry = f"[{machine_num}-{i}] [{log_level[i % len(log_level)]}] {log_messages[i]}\n"
|
||||
#on all
|
||||
if i == 0:
|
||||
log_entry = f"[{machine_num}-{i}] [INFO] TEST_ALL\n"
|
||||
#unique
|
||||
elif i == 1:
|
||||
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}] [{log_level[random.randint(0, len(log_level) - 1)]}] {log_messages[random.randint(0, len(log_messages) - 1)]}\n"
|
||||
with open(machine_log_file, "a") as file:
|
||||
file.write(log_entry)
|
||||
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