Added argument to change log format. (#414)

This commit is contained in:
Abhimanyu Saharan 2022-04-08 21:59:57 +05:30 committed by Carlton Gibson
parent 5e709795b4
commit 87bc5a7975
2 changed files with 8 additions and 1 deletions

View File

@ -11,6 +11,8 @@ Unreleased
range of versions does not represent a good use of maintainer time. Going
forward the latest Twisted version will be required.
* Added `log-fmt` CLI argument.
3.0.2 (2021-04-07)
------------------

View File

@ -90,6 +90,11 @@ class CommandLineInterface:
help="Where to write the access log (- for stdout, the default for verbosity=1)",
default=None,
)
self.parser.add_argument(
"--log-fmt",
help="Log format to use",
default="%(asctime)-15s %(levelname)-8s %(message)s"
)
self.parser.add_argument(
"--ping-interval",
type=int,
@ -215,7 +220,7 @@ class CommandLineInterface:
2: logging.DEBUG,
3: logging.DEBUG, # Also turns on asyncio debug
}[args.verbosity],
format="%(asctime)-15s %(levelname)-8s %(message)s",
format=args.log_fmt,
)
# If verbosity is 1 or greater, or they told us explicitly, set up access log
access_log_stream = None