Skip to content

Commit 0c1551a

Browse files
Added pro / con bullets to the list of ways to configure a logger
1 parent 1cfb637 commit 0c1551a

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

docs/writing/logging.rst

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,20 @@ application environment.
8282

8383
There are at least three ways to configure a logger:
8484

85-
- using a file
86-
- using a dictionary
87-
- using code
85+
- Using an INI-formatted file:
86+
- *Pro* -- possible to update configuration while running
87+
using the function :func:`logging.config.listen` to listen
88+
on a socket.
89+
- *Con* -- less control (*e.g.* custom subclassed filters or loggers)
90+
than possible when configuring a logger in code.
91+
- Using a dictionary or a JSON-formatted file:
92+
- *Pro* -- in addition to updating while running, it is possible to
93+
load from a file using the :mod:`json` module, in the standard
94+
library since Python 2.6.
95+
- *Con* -- less control than when configuring a logger in code.
96+
- Using code:
97+
- *Pro* -- complete control over the configuration.
98+
- *Con* -- modifications require a change to source code.
8899

89100

90101
Example Configuration via an INI File

0 commit comments

Comments
 (0)