testing
This commit is contained in:
1 parent
91b7863872
commit
47a389ca80
2 files changed
+38
-4
No files matched your search
+9
-4
@@ -1,7 +1,7 @@
|
||||
import random
|
||||
|
||||
machine_num = input("Enter the machine number: ")
|
||||
machine_log_file = f"machine.{machine_num}.log"
|
||||
machine_log_file = f"machine.{machine_num}.test.log"
|
||||
num_lines = int(input("Enter the number of log lines to generate: "))
|
||||
|
||||
log_level = ["TRACE", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL", "AUDIT"]
|
||||
@@ -20,7 +20,12 @@ log_messages = [
|
||||
"System update installed.",
|
||||
]
|
||||
|
||||
#first 11 in this log file should be extact order in log_messages list and then random from there
|
||||
|
||||
for i in range(num_lines):
|
||||
log_entry = f"[{machine_num}-{random.randint(1000, 9999)}] [{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)
|
||||
if i < 11:
|
||||
log_entry = f"[{machine_num}-{i}] [{log_level[i % len(log_level)]}] {log_messages[i]}\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)
|
||||
Reference in new issue
Block a user