summaryrefslogtreecommitdiff
path: root/example.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2019-03-25 09:19:01 +0200
committerLars Wirzenius <liw@liw.fi>2019-03-25 09:19:01 +0200
commitf7ed2c69f3840f54bd3e54973821b308a998b063 (patch)
tree3e894b34a0807a116c1ea136bddb4b5f8a1612ca /example.py
downloaddebuglog-f7ed2c69f3840f54bd3e54973821b308a998b063.tar.gz
Add: initial commitHEADmaster
Diffstat (limited to 'example.py')
-rw-r--r--example.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/example.py b/example.py
new file mode 100644
index 0000000..d90af3e
--- /dev/null
+++ b/example.py
@@ -0,0 +1,18 @@
+import os
+
+import debuglog
+
+
+dlog = debuglog.DebugLog()
+
+dlog.add_to_preamble(msg='Program starts', version='1.2.3')
+for name in os.environ:
+ dlog.add_to_preamble(
+ msg='Environment variable', name=name, value=os.environ[name])
+dlog.set_ring_buffer_size(3)
+dlog.log(msg='first')
+dlog.log(msg='second')
+dlog.log(msg='third')
+dlog.log(msg='fourth')
+
+dlog.write_ring_buffer('example.debuglog')