Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8e343860
Commit
8e343860
authored
May 08, 2010
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add logging.dictConfig example; give up on writing a Ttk example
parent
22097e4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
4 deletions
+58
-4
Doc/whatsnew/2.7.rst
Doc/whatsnew/2.7.rst
+58
-4
No files found.
Doc/whatsnew/2.7.rst
View file @
8e343860
...
...
@@ -389,7 +389,54 @@ Python's standard library now includes a JSON parser, so you could
parse a file containing JSON, or you could use a YAML parsing library
if one is installed.
XXX describe an example.
The following example configures two loggers, the root logger and a
logger named "network". Messages sent to the root logger will be
sent to the system log using the syslog protocol, and messages
to the "network" logger will be written to a :file:`network.log` file
that will be rotated once the log reaches 1Mb.
::
import logging
import logging.config
configdict = {
'version': 1, # Must be 1 at present
'formatters': {
'standard': {
'format': '%(asctime)s %(name)-15s %(levelname)-8s %(message)s'}},
'handlers': {'netlog': {'backupCount': 10,
'class': 'logging.handlers.RotatingFileHandler',
'filename': '/logs/network.log',
'formatter': 'standard',
'level': 'INFO',
'maxBytes': 1024*1024},
'syslog': {'class': 'logging.handlers.SysLogHandler',
'formatter': 'standard',
'level': 'ERROR'}},
# Specify all the subordinate loggers
'loggers': {
'network': {
'handlers': ['netlog']
}
},
# Specify properties of the root logger
'root': {
'handlers': ['syslog']
},
}
# Set up configuration
logging.config.dictConfig(configdict)
# As an example, log two error messages
logger = logging.getLogger('/')
logger.error('Database not found')
netlogger = logging.getLogger('network')
netlogger.error('Connection failed')
Three smaller enhancements to the :mod:`logging` module, all
implemented by Vinay Sajip, are:
...
...
@@ -1624,8 +1671,10 @@ Some of the functions in the module are:
Consult the :mod:`sysconfig` documentation for more details and for
a complete list of functions.
The Distutils package and :mod:`sysconfig` are now maintained and
renamed by Tarek Ziadé.
The Distutils package and :mod:`sysconfig` are now maintained by Tarek
Ziadé, who has also started a Distutils2 package (source repository at
http://hg.python.org/distutils2/) for developing a next-generation
version of Distutils.
ttk: Themed Widgets for Tk
...
...
@@ -1637,7 +1686,12 @@ closely resemble the native platform's widgets. This widget
set was originally called Tile, but was renamed to Ttk (for "themed Tk")
on being added to Tcl/Tck release 8.5.
XXX write a brief discussion and an example here.
To learn more, read the :mod:`ttk` module documentation. You may also
wish to read Tcl/Tk manual page describing the
Ttk theme engine, available at
http://www.tcl.tk/man/tcl8.5/TkCmd/ttk_intro.htm. Some
screenshots of the Python/Ttk code in use are at
http://code.google.com/p/python-ttk/wiki/Screenshots.
The :mod:`ttk` module was written by Guilherme Polo and added in
:issue:`2983`. An alternate version called ``Tile.py``, written by
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment