summaryrefslogtreecommitdiffstats
path: root/demo/loggen.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:44:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:44:55 +0000
commit5068d34c08f951a7ea6257d305a1627b09a95817 (patch)
tree08213e2be853396a3b07ce15dbe222644dcd9a89 /demo/loggen.py
parentInitial commit. (diff)
downloadlnav-5068d34c08f951a7ea6257d305a1627b09a95817.tar.xz
lnav-5068d34c08f951a7ea6257d305a1627b09a95817.zip
Adding upstream version 0.11.1.upstream/0.11.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xdemo/loggen.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/demo/loggen.py b/demo/loggen.py
new file mode 100755
index 0000000..6790a09
--- /dev/null
+++ b/demo/loggen.py
@@ -0,0 +1,54 @@
+import datetime
+import os
+import random
+import shutil
+import sys
+
+MSGS = [
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
+ "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
+ "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.",
+ "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
+]
+
+GLOG_DATE_FMT = "%Y%m%d %H:%M:%S"
+
+START_TIME = datetime.datetime.fromtimestamp(1490191111)
+
+try:
+ shutil.rmtree("/tmp/demo")
+ os.makedirs("/tmp/demo")
+except OSError:
+ pass
+
+PIDS = [
+ "123",
+ "123",
+ "123",
+ "121",
+ "124",
+ "123",
+ "61456",
+ "61456",
+ "61457",
+]
+
+LOG_LOCS = [
+ "demo.cc:123",
+ "demo.cc:352",
+ "loader.cc:13",
+ "loader.cc:552",
+ "blaster.cc:352",
+ "blaster.cc:112",
+ "blaster.cc:6782",
+]
+
+CURR_TIME = START_TIME
+for _index in range(0, int(sys.argv[1])):
+ CURR_TIME += datetime.timedelta(seconds=random.randrange(1, 22))
+ print("I%s.%06d %s %s] %s" % (
+ CURR_TIME.strftime(GLOG_DATE_FMT),
+ random.randrange(0, 100000),
+ random.choice(PIDS),
+ random.choice(LOG_LOCS),
+ random.choice(MSGS)))