]> www.dolda2000.com Git - ashd.git/commitdiff
python: Respect ASHD_USESYSLOG better. master
authorFredrik Tolf <fredrik@dolda2000.com>
Thu, 1 Jan 2026 16:54:57 +0000 (17:54 +0100)
committerFredrik Tolf <fredrik@dolda2000.com>
Thu, 1 Jan 2026 16:54:57 +0000 (17:54 +0100)
python3/ashd-wsgi3
python3/scgi-wsgi3

index c10bfc93cc4933687634b902e6c9cc6c7f69076d..6a91a145490ceb1cb59700cb4da1a03bfb1df1ab 100755 (executable)
@@ -35,7 +35,13 @@ if len(args) < 1:
     usage(sys.stderr)
     sys.exit(1)
 if setlog:
-    logging.basicConfig(format="ashd-wsgi3(%(name)s): %(levelname)s: %(message)s")
+    params = {"format": "ashd-wsgi3[%(name)s]: %(levelname)s: %(message)s",
+              "level": logging.INFO,
+              }
+    if os.getenv("ASHD_USESYSLOG"):
+        import logging.handlers
+        params["handlers"] = [logging.handlers.SysLogHandler("/dev/log")]
+    logging.basicConfig(**params)
 log = logging.getLogger("ashd-wsgi3")
 
 try:
index a8fccf04f21dec1a380b0574540c384a4f6cee7e..bd565ab2c701e86f2761cf1a94a8f98f375974e7 100755 (executable)
@@ -47,7 +47,13 @@ if len(args) < 1:
     usage(sys.stderr)
     sys.exit(1)
 if setlog:
-    logging.basicConfig(format="scgi-wsgi3(%(name)s): %(levelname)s: %(message)s")
+    params = {"format": "scgi-wsgi3[%(name)s]: %(levelname)s: %(message)s",
+              "level": logging.INFO,
+              }
+    if os.getenv("ASHD_USESYSLOG"):
+        import logging.handlers
+        params["handlers"] = [logging.handlers.SysLogHandler("/dev/log")]
+    logging.basicConfig(**params)
 
 if sk is None:
     # This is suboptimal, since the socket on stdin is not necessarily