Skip to content

Commit

Permalink
Added argument to change log format. (#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi1693 authored and carltongibson committed May 23, 2022
1 parent 5e70979 commit 87bc5a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
------------------

Expand Down
7 changes: 6 additions & 1 deletion daphne/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ def __init__(self):
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,
Expand Down Expand Up @@ -215,7 +220,7 @@ def run(self, args):
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
Expand Down

0 comments on commit 87bc5a7

Please sign in to comment.