[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [sbws/master] Log sbws version info line on startup



commit cccfc73fd328a0d9f9e4551bde999bfac11156c5
Author: Matt Traudt <sirmatt@xxxxxxx>
Date:   Wed Jul 11 11:30:48 2018 -0400

    Log sbws version info line on startup
---
 CHANGELOG.md |  5 +++++
 sbws/sbws.py | 12 ++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c94761d..19b1067 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
 
 ## [Unreleased]
 
+### Added
+
+- Log line on start up with sbws version, platform info, and library versions
+(trac#26751)
+
 ## [0.6.0] - 2018-07-11
 
 **Important changes**:
diff --git a/sbws/sbws.py b/sbws/sbws.py
index 5688cea..c8a6378 100644
--- a/sbws/sbws.py
+++ b/sbws/sbws.py
@@ -7,6 +7,10 @@ from sbws.util.config import get_config
 from sbws.util.config import validate_config
 from sbws.util.config import configure_logging
 from sbws.util.parser import create_parser
+from sbws import __version__ as SBWS_VERSION
+from stem import __version__ as STEM_VERSION
+from requests.__version__ import __version__ as REQ_VERSION
+import platform
 import logging
 
 log = logging.getLogger(__name__)
@@ -18,6 +22,13 @@ def _adjust_log_level(args, conf):
     conf['logger_sbws']['level'] = args.log_level
 
 
+def _get_startup_line():
+    py_ver = platform.python_version()
+    py_plat = platform.platform()
+    return 'sbws %s with python %s on %s, stem %s, and requests %s' % \
+        (SBWS_VERSION, py_ver, py_plat, STEM_VERSION, REQ_VERSION)
+
+
 def main():
     parser = create_parser()
     args = parser.parse_args()
@@ -47,6 +58,7 @@ def main():
         if args.command not in known_commands:
             parser.print_help()
         else:
+            log.info(_get_startup_line())
             comm = known_commands[args.command]
             exit(comm['f'](*comm['a'], **comm['kw']))
     except KeyboardInterrupt:



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits