aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libpathod/pathoc.py1
-rw-r--r--libpathod/pathod.py3
-rwxr-xr-xpathoc2
-rwxr-xr-xpathod19
4 files changed, 21 insertions, 4 deletions
diff --git a/libpathod/pathoc.py b/libpathod/pathoc.py
index 5ad1bd26..e378e863 100644
--- a/libpathod/pathoc.py
+++ b/libpathod/pathoc.py
@@ -1,7 +1,6 @@
from netlib import tcp, http
import rparse
-
class PathocError(Exception): pass
diff --git a/libpathod/pathod.py b/libpathod/pathod.py
index c84be420..6fc0d204 100644
--- a/libpathod/pathod.py
+++ b/libpathod/pathod.py
@@ -1,7 +1,8 @@
-import urllib, threading, re
+import urllib, threading, re, logging
from netlib import tcp, http, odict, wsgi
import version, app, rparse
+
class PathodError(Exception): pass
diff --git a/pathoc b/pathoc
index 12edc34a..0115516b 100755
--- a/pathoc
+++ b/pathoc
@@ -10,7 +10,7 @@ if __name__ == "__main__":
parser.add_argument('request', type=str, nargs="+", help='Request specification')
args = parser.parse_args()
-
+
if args.port is None:
port = 443 if args.ssl else 80
else:
diff --git a/pathod b/pathod
index b4ee7eb3..7ba5ad80 100755
--- a/pathod
+++ b/pathod
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-import argparse, sys
+import argparse, sys, logging
from libpathod import pathod, utils, version
if __name__ == "__main__":
@@ -15,6 +15,11 @@ if __name__ == "__main__":
help='Directory for static files.'
)
parser.add_argument(
+ "--debug", dest='debug', default=False,
+ action="store_true",
+ help='Enable debug output.'
+ )
+ parser.add_argument(
"-s", dest='ssl', default=False,
action="store_true",
help='Serve with SSL.'
@@ -50,6 +55,18 @@ if __name__ == "__main__":
parser.error("Invalid anchor specification: %s"%i)
alst.append(parts)
+ root = logging.getLogger()
+ if root.handlers:
+ for handler in root.handlers:
+ root.removeHandler(handler)
+ logging.basicConfig(
+ format='%(asctime)s: %(message)s',
+ datefmt='%d-%m-%y %I:%M:%S',
+ level=logging.DEBUG
+ )
+ if not args.debug:
+ logging.disable(logging.DEBUG)
+
try:
pd = pathod.Pathod(
(args.address, args.port),