mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
Logging truss for pathod.
This commit is contained in:
parent
90c6fb394d
commit
65487ead6d
@ -1,7 +1,6 @@
|
||||
from netlib import tcp, http
|
||||
import rparse
|
||||
|
||||
|
||||
class PathocError(Exception): pass
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
19
pathod
19
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__":
|
||||
@ -14,6 +14,11 @@ if __name__ == "__main__":
|
||||
"-d", dest='staticdir', default=None, type=str,
|
||||
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",
|
||||
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user