Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
97b886dc
Kaydet (Commit)
97b886dc
authored
Ara 12, 2010
tarafından
Vinay Sajip
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Logging documentation - further update.
üst
36675b6a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
4 deletions
+24
-4
logging.rst
Doc/library/logging.rst
+24
-4
No files found.
Doc/library/logging.rst
Dosyayı görüntüle @
97b886dc
...
...
@@ -146,15 +146,35 @@ messages::
INFO
:
root
:
So
should
this
WARNING
:
root
:
And
this
,
too
This
example
also
shows
how
you
can
set
the
logging
level
which
acts
as
the
threshold
for
tracking
.
In
this
case
,
because
we
set
the
threshold
to
``
DEBUG
``,
all
of
the
messages
were
printed
.
If
you
want
to
set
the
logging
level
from
a
command
-
line
option
such
as
::
--
log
=
INFO
and
you
have
the
value
of
the
parameter
passed
for
``--
log
``
in
some
variable
*
loglevel
*,
you
can
use
::
getattr
(
logging
,
loglevel
.
upper
())
to
get
the
value
which
you
'll pass to :func:`basicConfig` via the *level*
argument. You may want to error check any user input value, perhaps as in the
following example::
# assuming loglevel is bound to the string value obtained from the
# command line argument. Convert to upper case to allow the user to
# specify --log=DEBUG or --log=debug
numeric_level = getattr(logging, loglevel.upper(), None)
assert numeric_level is not None, '
Invalid
log
level
:
%
s
' % loglevel
logging.basicConfig(level=numeric_level, ...)
The call to :func:`basicConfig` should come *before* any calls to :func:`debug`,
:func:`info` etc. As it'
s
intended
as
a
one
-
off
simple
configuration
facility
,
only
the
first
call
will
actually
do
anything
:
subsequent
calls
are
effectively
no
-
ops
.
This example also shows how you can set the logging level which acts as the
threshold for tracking. In this case, because we set the threshold to
``DEBUG``, all of the messages were printed.
If
you
run
the
above
script
several
times
,
the
messages
from
successive
runs
are
appended
to
the
file
*
example
.
log
*.
If
you
want
each
run
to
start
afresh
,
not
remembering
the
messages
from
earlier
runs
,
you
can
specify
the
*
filemode
*
...
...
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