2018-07-04 09:06:45 +00:00
|
|
|
|
# Copyright (C) 2001-2018, Python Software Foundation
|
2018-07-04 09:08:42 +00:00
|
|
|
|
# For licence information, see README file.
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Project-Id-Version: Python 3.6\n"
|
|
|
|
|
"Report-Msgid-Bugs-To: \n"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"POT-Creation-Date: 2018-06-10 11:27+0200\n"
|
|
|
|
|
"PO-Revision-Date: 2018-11-12 23:09+0100\n"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
2018-07-04 09:14:25 +00:00
|
|
|
|
"Language-Team: FRENCH <traductions@lists.afpy.org>\n"
|
2017-05-23 22:40:56 +00:00
|
|
|
|
"Language: fr\n"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
"MIME-Version: 1.0\n"
|
|
|
|
|
"Content-Type: text/plain; charset=UTF-8\n"
|
|
|
|
|
"Content-Transfer-Encoding: 8bit\n"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:3
|
|
|
|
|
msgid "Logging HOWTO"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Tutoriel sur la journalisation"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2017-12-01 06:48:13 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:0
|
|
|
|
|
msgid "Author"
|
2018-01-21 22:53:31 +00:00
|
|
|
|
msgstr "Auteur"
|
2017-12-01 06:48:13 +00:00
|
|
|
|
|
2016-10-30 09:46:26 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:5
|
|
|
|
|
msgid "Vinay Sajip <vinay_sajip at red-dove dot com>"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:12
|
|
|
|
|
msgid "Basic Logging Tutorial"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Les bases de l'utilisation du module `logging`"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:14
|
|
|
|
|
msgid ""
|
|
|
|
|
"Logging is a means of tracking events that happen when some software runs. "
|
|
|
|
|
"The software's developer adds logging calls to their code to indicate that "
|
|
|
|
|
"certain events have occurred. An event is described by a descriptive message "
|
|
|
|
|
"which can optionally contain variable data (i.e. data that is potentially "
|
|
|
|
|
"different for each occurrence of the event). Events also have an importance "
|
|
|
|
|
"which the developer ascribes to the event; the importance can also be called "
|
|
|
|
|
"the *level* or *severity*."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"La journalisation (*logging* en anglais) est une façon de suivre les "
|
|
|
|
|
"événements qui ont lieu durant le fonctionnement d'un logiciel. Le "
|
|
|
|
|
"développeur du logiciel ajoute des appels à l'outil de journalisation dans "
|
|
|
|
|
"son code pour indiquer que certains événements ont eu lieu. Un événement est "
|
|
|
|
|
"décrit par un message descriptif, qui peut éventuellement contenir des "
|
|
|
|
|
"données variables (c'est-à-dire qui peuvent être différentes pour chaque "
|
|
|
|
|
"occurrence de l'événement). Un événement a aussi une importance que la "
|
|
|
|
|
"développeur lui attribue ; cette importance peut aussi être appelée *niveau* "
|
|
|
|
|
"ou *sévérité*."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:23
|
|
|
|
|
msgid "When to use logging"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Quand utiliser `logging`"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:25
|
|
|
|
|
msgid ""
|
|
|
|
|
"Logging provides a set of convenience functions for simple logging usage. "
|
|
|
|
|
"These are :func:`debug`, :func:`info`, :func:`warning`, :func:`error` and :"
|
|
|
|
|
"func:`critical`. To determine when to use logging, see the table below, "
|
|
|
|
|
"which states, for each of a set of common tasks, the best tool to use for it."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Le module *logging* fournit un ensemble de fonctions de commodités pour une "
|
|
|
|
|
"utilisation simple du module. Ce sont les fonctions :func:`debug`, :func:"
|
|
|
|
|
"`info`, :func:`warning`, :func:`error` et :func:`critical`. Pour déterminer "
|
|
|
|
|
"quand employer la journalisation, voyez la table ci-dessous, qui vous "
|
|
|
|
|
"indique, pour chaque tâche parmi les plus communes, l'outil approprié."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:31
|
|
|
|
|
msgid "Task you want to perform"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Tâche que vous souhaitez mener"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:31
|
|
|
|
|
msgid "The best tool for the task"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Le meilleur outil pour cette tâche"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:33
|
|
|
|
|
msgid ""
|
|
|
|
|
"Display console output for ordinary usage of a command line script or program"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Afficher la sortie console d'un script en ligne de commande ou d'un "
|
|
|
|
|
"programme lors de son utilisation ordinaire."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:33
|
|
|
|
|
msgid ":func:`print`"
|
|
|
|
|
msgstr ":func:`print`"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:37
|
|
|
|
|
msgid ""
|
|
|
|
|
"Report events that occur during normal operation of a program (e.g. for "
|
|
|
|
|
"status monitoring or fault investigation)"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Rapporter des évènements qui ont lieu au cours du fonctionnement normal d'un "
|
|
|
|
|
"programme (par exemple pour suivre un statut ou examiner des "
|
|
|
|
|
"dysfonctionnements)"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:37
|
|
|
|
|
msgid ""
|
|
|
|
|
":func:`logging.info` (or :func:`logging.debug` for very detailed output for "
|
|
|
|
|
"diagnostic purposes)"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
":func:`logging.info` (ou :func:`logging.debug` pour une sortie très "
|
|
|
|
|
"détaillée à visée diagnostique)"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:42
|
|
|
|
|
msgid "Issue a warning regarding a particular runtime event"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Émettre un avertissement (*warning* en anglais) en relation avec un "
|
|
|
|
|
"évènement particulier au cours du fonctionnement"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:42
|
|
|
|
|
msgid ""
|
|
|
|
|
":func:`warnings.warn` in library code if the issue is avoidable and the "
|
|
|
|
|
"client application should be modified to eliminate the warning"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
":func:`warnings.warn` dans le code de la bibliothèque si le problème est "
|
|
|
|
|
"évitable et l'application cliente doit être modifiée pour éliminer ce "
|
|
|
|
|
"*warning*"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:47
|
|
|
|
|
msgid ""
|
|
|
|
|
":func:`logging.warning` if there is nothing the client application can do "
|
|
|
|
|
"about the situation, but the event should still be noted"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
":func:`logging.warning` si l'application cliente ne peut rien faire pour "
|
|
|
|
|
"corriger la situation mais l'évènement devrait quand même être noté"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:52
|
|
|
|
|
msgid "Report an error regarding a particular runtime event"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Rapporter une erreur lors d'un évènement particulier en cours d'exécution"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:52
|
|
|
|
|
msgid "Raise an exception"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Lever une exception"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:55
|
|
|
|
|
msgid ""
|
|
|
|
|
"Report suppression of an error without raising an exception (e.g. error "
|
|
|
|
|
"handler in a long-running server process)"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Rapporter la suppression d'une erreur sans lever d'exception (par exemple "
|
|
|
|
|
"pour la gestion d'erreur d'un processus de long terme sur un serveur)"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:55
|
|
|
|
|
msgid ""
|
|
|
|
|
":func:`logging.error`, :func:`logging.exception` or :func:`logging.critical` "
|
|
|
|
|
"as appropriate for the specific error and application domain"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
":func:`logging.error`, :func:`logging.exception` ou :func:`logging."
|
|
|
|
|
"critical`, au mieux, selon l'erreur spécifique et le domaine d'application"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:62
|
|
|
|
|
msgid ""
|
|
|
|
|
"The logging functions are named after the level or severity of the events "
|
|
|
|
|
"they are used to track. The standard levels and their applicability are "
|
|
|
|
|
"described below (in increasing order of severity):"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Les fonctions de journalisation sont nommées d'après le niveau ou la "
|
|
|
|
|
"sévérité des évènements qu'elles suivent. Les niveaux standards et leurs "
|
|
|
|
|
"applications sont décrits ci-dessous (par ordre croissant de sévérité) :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:69 ../Doc/howto/logging.rst:846
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Level"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Niveau"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:69
|
|
|
|
|
msgid "When it's used"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Quand il est utilisé"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:71 ../Doc/howto/logging.rst:856
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "``DEBUG``"
|
|
|
|
|
msgstr "``DEBUG``"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:71
|
|
|
|
|
msgid ""
|
|
|
|
|
"Detailed information, typically of interest only when diagnosing problems."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Information détaillée, intéressante seulement lorsqu'on diagnostique un "
|
|
|
|
|
"problème."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:74 ../Doc/howto/logging.rst:854
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "``INFO``"
|
|
|
|
|
msgstr "``INFO``"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:74
|
|
|
|
|
msgid "Confirmation that things are working as expected."
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Confirmation que tout fonctionne comme prévu"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:77 ../Doc/howto/logging.rst:852
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "``WARNING``"
|
|
|
|
|
msgstr "``WARNING``"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:77
|
|
|
|
|
msgid ""
|
|
|
|
|
"An indication that something unexpected happened, or indicative of some "
|
|
|
|
|
"problem in the near future (e.g. 'disk space low'). The software is still "
|
|
|
|
|
"working as expected."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"L'indication que quelque chose d'inattendu a eu lieu, ou de la possibilité "
|
|
|
|
|
"d'un problème dans un futur proche (par exemple « espace disque faible »). "
|
|
|
|
|
"Le logiciel fonctionne encore normalement."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:82 ../Doc/howto/logging.rst:850
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "``ERROR``"
|
|
|
|
|
msgstr "``ERROR``"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:82
|
|
|
|
|
msgid ""
|
|
|
|
|
"Due to a more serious problem, the software has not been able to perform "
|
|
|
|
|
"some function."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Du fait d'un problème plus sérieux, le logiciel n'a pas été capable de "
|
|
|
|
|
"réaliser une tâche."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:85 ../Doc/howto/logging.rst:848
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "``CRITICAL``"
|
|
|
|
|
msgstr "``CRITICAL``"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:85
|
|
|
|
|
msgid ""
|
|
|
|
|
"A serious error, indicating that the program itself may be unable to "
|
|
|
|
|
"continue running."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Une erreur sérieuse, indiquant que le programme lui-même pourrait être "
|
|
|
|
|
"incapable de continuer à fonctionner."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:89
|
|
|
|
|
msgid ""
|
|
|
|
|
"The default level is ``WARNING``, which means that only events of this level "
|
|
|
|
|
"and above will be tracked, unless the logging package is configured to do "
|
|
|
|
|
"otherwise."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Le niveau par défaut est ``WARNING``, ce qui signifie que seuls les "
|
|
|
|
|
"évènements de ce niveau et au dessus sont suivis, sauf si le paquet "
|
|
|
|
|
"*logging* est configuré pour faire autrement."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:93
|
|
|
|
|
msgid ""
|
|
|
|
|
"Events that are tracked can be handled in different ways. The simplest way "
|
|
|
|
|
"of handling tracked events is to print them to the console. Another common "
|
|
|
|
|
"way is to write them to a disk file."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Les évènements suivis peuvent être gérés de différentes façons. La manière "
|
|
|
|
|
"la plus simple est de les afficher dans la console. Une autre méthode "
|
|
|
|
|
"commune est de les écrire dans un fichier."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:101
|
|
|
|
|
msgid "A simple example"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Un exemple simple"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:103
|
|
|
|
|
msgid "A very simple example is::"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Un exemple très simple est : ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:109
|
|
|
|
|
msgid "If you type these lines into a script and run it, you'll see:"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Si vous entrez ces lignes dans un script que vous exécutez, vous verrez :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:115
|
|
|
|
|
msgid ""
|
|
|
|
|
"printed out on the console. The ``INFO`` message doesn't appear because the "
|
|
|
|
|
"default level is ``WARNING``. The printed message includes the indication of "
|
|
|
|
|
"the level and the description of the event provided in the logging call, i."
|
|
|
|
|
"e. 'Watch out!'. Don't worry about the 'root' part for now: it will be "
|
|
|
|
|
"explained later. The actual output can be formatted quite flexibly if you "
|
|
|
|
|
"need that; formatting options will also be explained later."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"affiché dans la console. Le message ``INFO`` n'apparaît pas parce que le "
|
|
|
|
|
"niveau par défaut est ``WARNING``. Le message affiché inclut l'indication du "
|
|
|
|
|
"niveau et la description de l'évènement fournie dans l'appel à *logging*, i."
|
|
|
|
|
"e. « Watch out! ». Ne vous préoccupez pas de la partie « *root* » pour le "
|
|
|
|
|
"moment : nous détaillerons ce point plus bas. La sortie elle même peut être "
|
|
|
|
|
"formatée de multiples manières si besoin. Les options de formatage seront "
|
|
|
|
|
"aussi expliquées plus bas."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:124
|
|
|
|
|
msgid "Logging to a file"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Enregistrer les évènements dans un fichier"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:126
|
|
|
|
|
msgid ""
|
|
|
|
|
"A very common situation is that of recording logging events in a file, so "
|
|
|
|
|
"let's look at that next. Be sure to try the following in a newly-started "
|
|
|
|
|
"Python interpreter, and don't just continue from the session described "
|
|
|
|
|
"above::"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Il est très commun d'enregistrer les évènements dans un fichier, c'est donc "
|
|
|
|
|
"ce que nous allons regarder maintenant. Il faut essayer ce qui suit avec un "
|
|
|
|
|
"interpréteur Python nouvellement démarré, ne poursuivez pas la session "
|
|
|
|
|
"commencée ci-dessus ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/howto/logging.rst:136
|
|
|
|
|
msgid ""
|
|
|
|
|
"And now if we open the file and look at what we have, we should find the log "
|
2018-04-28 22:28:01 +00:00
|
|
|
|
"messages:"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Maintenant, si nous ouvrons le fichier et lisons ce qui s'y trouve, on "
|
|
|
|
|
"trouvera les messages de log :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:145
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"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."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Cet exemple montre aussi comment on peut régler le niveau de journalisation "
|
|
|
|
|
"qui sert de seuil pour le suivi. Dans ce cas, comme nous avons réglé le "
|
|
|
|
|
"seuil à ``DEBUG``, tous les messages ont été écrits."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:149
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2018-04-28 22:28:01 +00:00
|
|
|
|
"If you want to set the logging level from a command-line option such as:"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Si vous souhaitez régler le niveau de *logging* à partir d'une option de la "
|
|
|
|
|
"ligne de commande comme :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:155
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"and you have the value of the parameter passed for ``--log`` in some "
|
|
|
|
|
"variable *loglevel*, you can use::"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"et que vous passez ensuite la valeur du paramètre donné à l'option `--log` "
|
|
|
|
|
"dans une variable *loglevel*, vous pouvez utiliser : ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:160
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"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::"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"de manière à obtenir la valeur à passer à :func:`basicConfig` à travers "
|
|
|
|
|
"l'argument *level*. Vous pouvez vérifier que l'utilisateur n'a fait aucune "
|
|
|
|
|
"erreur pour la valeur de ce paramètre, comme dans l'exemple ci-dessous : ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:172
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"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."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"L'appel à :func:`basicConfig` doit être fait *avant* un appel à :func:"
|
|
|
|
|
"`debug`, :func:`info`, etc. Comme l'objectif est d'avoir un outil de "
|
|
|
|
|
"configuration simple et d'usage unique, seul le premier appel aura un effet, "
|
|
|
|
|
"les appels suivants ne font rien."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:177
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"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* argument, by changing the call in the above example to::"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Si vous exécutez le script plusieurs fois, les messages des exécutions "
|
|
|
|
|
"successives sont ajoutés au fichier *example.log*. Si vous voulez que chaque "
|
|
|
|
|
"exécution reprenne un fichier vierge, sans conserver les messages des "
|
|
|
|
|
"exécutions précédentes, vous pouvez spécifier l'argument *filemode*, en "
|
|
|
|
|
"changeant l'appel à l'exemple précédent par ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:184
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The output will be the same as before, but the log file is no longer "
|
|
|
|
|
"appended to, so the messages from earlier runs are lost."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"La sortie est identique à la précédente, mais le texte n'est plus ajouté au "
|
|
|
|
|
"fichier de log, donc les messages des exécutions précédentes sont perdus."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:189
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Logging from multiple modules"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Employer *logging* à partir de différents modules"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:191
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"If your program consists of multiple modules, here's an example of how you "
|
|
|
|
|
"could organize logging in it::"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Si votre programme est composé de plusieurs modules, voici une façon "
|
|
|
|
|
"d'organiser\n"
|
|
|
|
|
"l'outil de journalisation : ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:215
|
|
|
|
|
msgid "If you run *myapp.py*, you should see this in *myapp.log*:"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Si vous exécutez *myapp.py*, vous verrez ceci dans *myapp.log* :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:223
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"which is hopefully what you were expecting to see. You can generalize this "
|
|
|
|
|
"to multiple modules, using the pattern in *mylib.py*. Note that for this "
|
|
|
|
|
"simple usage pattern, you won't know, by looking in the log file, *where* in "
|
|
|
|
|
"your application your messages came from, apart from looking at the event "
|
|
|
|
|
"description. If you want to track the location of your messages, you'll need "
|
|
|
|
|
"to refer to the documentation beyond the tutorial level -- see :ref:`logging-"
|
|
|
|
|
"advanced-tutorial`."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"ce qui est normalement ce à quoi vous vous attendiez. Vous pouvez "
|
|
|
|
|
"généraliser cela à plusieurs modules, en employant le motif de *mylib.py*. "
|
|
|
|
|
"Remarquez qu'avec cette méthode simple, vous ne pourrez pas savoir, en "
|
|
|
|
|
"lisant le fichier de log, *d'où* viennent les messages dans votre "
|
|
|
|
|
"application, sauf dans la description de l'évènement. Si vous voulez suivre "
|
|
|
|
|
"la localisation des messages, référerez vous à la documentation avancée :ref:"
|
|
|
|
|
"`logging-advanced-tutorial`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:233
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Logging variable data"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Journalisation de données variables"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:235
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"To log variable data, use a format string for the event description message "
|
|
|
|
|
"and append the variable data as arguments. For example::"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Pour enregistrer des données variables, utilisez une chaîne formatée dans le "
|
|
|
|
|
"message de description de l'évènement et ajoutez les données variables comme "
|
|
|
|
|
"argument. Par exemple : ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:241
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "will display:"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "affichera :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:247
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"As you can see, merging of variable data into the event description message "
|
|
|
|
|
"uses the old, %-style of string formatting. This is for backwards "
|
|
|
|
|
"compatibility: the logging package pre-dates newer formatting options such "
|
|
|
|
|
"as :meth:`str.format` and :class:`string.Template`. These newer formatting "
|
|
|
|
|
"options *are* supported, but exploring them is outside the scope of this "
|
|
|
|
|
"tutorial: see :ref:`formatting-styles` for more information."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Comme vous pouvez le voir, l'inclusion des données variables dans le message "
|
|
|
|
|
"de description de l'évènement emploie le vieux style de formatage avec %. "
|
|
|
|
|
"C'est pour assurer la rétrocompatibilité : le module `logging` est antérieur "
|
|
|
|
|
"aux nouvelles options de formatage comme :meth:`str.format` ou :class:"
|
|
|
|
|
"`string.Template`. Ces nouvelles options de formatage *sont* gérées, mais "
|
|
|
|
|
"leur exploration sors du cadre de ce tutoriel, voyez :ref:`formatting-"
|
|
|
|
|
"styles` pour plus d'information."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:256
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Changing the format of displayed messages"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Modifier le format du message affiché"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:258
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"To change the format which is used to display messages, you need to specify "
|
|
|
|
|
"the format you want to use::"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Pour changer le format utilisé pour afficher le message, vous devez préciser "
|
|
|
|
|
"le format que vous souhaitez employer : ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:267
|
|
|
|
|
msgid "which would print:"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Ce qui affiche :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:275
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Notice that the 'root' which appeared in earlier examples has disappeared. "
|
|
|
|
|
"For a full set of things that can appear in format strings, you can refer to "
|
|
|
|
|
"the documentation for :ref:`logrecord-attributes`, but for simple usage, you "
|
|
|
|
|
"just need the *levelname* (severity), *message* (event description, "
|
|
|
|
|
"including variable data) and perhaps to display when the event occurred. "
|
|
|
|
|
"This is described in the next section."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Notez que le `root` qui apparaissait dans les exemples précédents a disparu. "
|
|
|
|
|
"Pour voir l'ensemble des éléments qui peuvent apparaître dans la chaîne de "
|
|
|
|
|
"format, référez-vous à la documentation pour :ref:`logrecord-attributes`. "
|
|
|
|
|
"Pour une utilisation simple, vous avez seulement besoin du *levelname* (la "
|
|
|
|
|
"sévérité), du *message* (la description de l'évènement, avec les données "
|
|
|
|
|
"variables) et peut-être du moment auquel l'évènement a eu lieu. Nous "
|
|
|
|
|
"décrivons ces points dans la prochaine section."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:284
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Displaying the date/time in messages"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Afficher l'horodatage dans les messages"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:286
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"To display the date and time of an event, you would place '%(asctime)s' in "
|
|
|
|
|
"your format string::"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Pour afficher la date ou le temps d'un évènement, ajoutez `%(asctime)` dans "
|
|
|
|
|
"votre chaîne de formatage : ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:293
|
|
|
|
|
msgid "which should print something like this:"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Ce qui affichera quelque chose comme :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:299
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2018-06-10 09:32:30 +00:00
|
|
|
|
"The default format for date/time display (shown above) is like ISO8601 or :"
|
|
|
|
|
"rfc:`3339`. If you need more control over the formatting of the date/time, "
|
2018-05-05 18:30:02 +00:00
|
|
|
|
"provide a *datefmt* argument to ``basicConfig``, as in this example::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Le format par défaut de l'horodatage (comme ci-dessus) est donné par la "
|
|
|
|
|
"norme ISO8601 ou :rfc:`3339`. Pour plus de contrôle sur le formatage de "
|
|
|
|
|
"l'horodatage, vous pouvez fournir à ``basicConfig`` un argument *datefmt*, "
|
|
|
|
|
"comme dans l'exemple suivant : ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:307
|
|
|
|
|
msgid "which would display something like this:"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Ce qui affichera quelque chose comme :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:313
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The format of the *datefmt* argument is the same as supported by :func:`time."
|
|
|
|
|
"strftime`."
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Le format de *datefmt* est le même que celui de :func:`time.strftime`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:318
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Next Steps"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Étapes suivantes"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:320
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"That concludes the basic tutorial. It should be enough to get you up and "
|
|
|
|
|
"running with logging. There's a lot more that the logging package offers, "
|
|
|
|
|
"but to get the best out of it, you'll need to invest a little more of your "
|
|
|
|
|
"time in reading the following sections. If you're ready for that, grab some "
|
|
|
|
|
"of your favourite beverage and carry on."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Nous concluons ainsi le tutoriel basique. Il devrait suffire à vous mettre "
|
|
|
|
|
"le pied à l'étrier pour utiliser `logging`. Le module `logging` a beaucoup "
|
|
|
|
|
"d'autre cordes à son arc, mais pour en profiter au maximum, vous devez "
|
|
|
|
|
"prendre le temps de lire les sections suivantes. Si vous êtes prêt, servez-"
|
|
|
|
|
"vous votre boisson préférée et poursuivons."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:326
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"If your logging needs are simple, then use the above examples to incorporate "
|
|
|
|
|
"logging into your own scripts, and if you run into problems or don't "
|
|
|
|
|
"understand something, please post a question on the comp.lang.python Usenet "
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"group (available at https://groups.google.com/group/comp.lang.python) and "
|
|
|
|
|
"you should receive help before too long."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Si vos besoins avec `logging` sont simples, vous pouvez incorporer les "
|
|
|
|
|
"exemples ci-dessus dans vos scripts. Si vous rencontrez des difficultés ou "
|
|
|
|
|
"s'il y a quelque chose que vous ne comprenez pas, vous pouvez poser une "
|
|
|
|
|
"question sur le groupe Usenet `comp.lang.python` (accessible à `https://"
|
|
|
|
|
"groups.google.com/group/comp.lang.python`_), on vous répondra rapidement."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:332
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Still here? You can carry on reading the next few sections, which provide a "
|
|
|
|
|
"slightly more advanced/in-depth tutorial than the basic one above. After "
|
|
|
|
|
"that, you can take a look at the :ref:`logging-cookbook`."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Vous êtes encore là ? Vous pouvez lire les prochaines section, qui donnent "
|
|
|
|
|
"un peu plus de détails que l'introduction ci-dessus. Après ça, vous pouvez "
|
|
|
|
|
"jeter un œil à :ref:`logging-cookbook`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:340
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Advanced Logging Tutorial"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Usage avancé de Logging"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:342
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The logging library takes a modular approach and offers several categories "
|
|
|
|
|
"of components: loggers, handlers, filters, and formatters."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"La bibliothèque de journalisation adopte une approche modulaire et offre "
|
|
|
|
|
"différentes catégories de composants : *loggers*, *handlers*, *filters* et "
|
|
|
|
|
"*formatters*."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:345
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Loggers expose the interface that application code directly uses."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Les enregistreurs (*loggers* en anglais) exposent l'interface que le code de "
|
|
|
|
|
"l'application utilise directement."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:346
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Handlers send the log records (created by loggers) to the appropriate "
|
|
|
|
|
"destination."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Les gestionnaires (*handlers*) envoient les entrées de journal (crées par "
|
|
|
|
|
"les *loggers*) vers les destinations voulues."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:348
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Filters provide a finer grained facility for determining which log records "
|
|
|
|
|
"to output."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Les filtres (*filters*) fournissent un moyen de choisir finement quelles "
|
|
|
|
|
"entrées de journal doivent être sorties."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:350
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Formatters specify the layout of log records in the final output."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Les formateurs (*formatters*) spécifient la structure de l'entrée de journal "
|
|
|
|
|
"dans la sortie finale."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:352
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Log event information is passed between loggers, handlers, filters and "
|
|
|
|
|
"formatters in a :class:`LogRecord` instance."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"L'information relative à un événement est passée entre *loggers*, *handlers* "
|
|
|
|
|
"et *formatters* dans une instance de la classe :class:`LogRecord`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:355
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Logging is performed by calling methods on instances of the :class:`Logger` "
|
|
|
|
|
"class (hereafter called :dfn:`loggers`). Each instance has a name, and they "
|
|
|
|
|
"are conceptually arranged in a namespace hierarchy using dots (periods) as "
|
|
|
|
|
"separators. For example, a logger named 'scan' is the parent of loggers "
|
|
|
|
|
"'scan.text', 'scan.html' and 'scan.pdf'. Logger names can be anything you "
|
|
|
|
|
"want, and indicate the area of an application in which a logged message "
|
|
|
|
|
"originates."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"La journalisation est réalisée en appelant les méthodes d'instance de la "
|
|
|
|
|
"classe :class:`Logger` (que l'on appelle ci-dessous :dfn:`loggers`). Chaque "
|
|
|
|
|
"instance a un nom, et sont organisées conceptuellement comme des hiérarchies "
|
|
|
|
|
"dans l'espace des noms, en utilisant un point comme séparateur. Par exemple, "
|
|
|
|
|
"un `logger` appelé `scan` est le parent des `loggers` `scan.text`, `scan."
|
|
|
|
|
"html` et `scan.pdf`. Les noms des `loggers` peuvent être ce que vous voulez "
|
|
|
|
|
"et indiquer le sous-domaine d'une application depuis lequel le message "
|
|
|
|
|
"enregistré a été émis."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:362
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"A good convention to use when naming loggers is to use a module-level "
|
|
|
|
|
"logger, in each module which uses logging, named as follows::"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Une bonne convention lorsqu'on nomme les *loggers* est d'utiliser un "
|
|
|
|
|
"*logger* au niveau du module, dans chaque module qui emploie `logging`, "
|
|
|
|
|
"nommé de la façon suivante : ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:367
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"This means that logger names track the package/module hierarchy, and it's "
|
|
|
|
|
"intuitively obvious where events are logged just from the logger name."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Cela signifie que le nom d'un `logger` se rapporte à la hiérarchie du paquet "
|
|
|
|
|
"et des modules, et il est évident où un événement à été enregistré "
|
|
|
|
|
"simplement en voyant le nom du `logger`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:370
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The root of the hierarchy of loggers is called the root logger. That's the "
|
|
|
|
|
"logger used by the functions :func:`debug`, :func:`info`, :func:`warning`, :"
|
|
|
|
|
"func:`error` and :func:`critical`, which just call the same-named method of "
|
|
|
|
|
"the root logger. The functions and the methods have the same signatures. The "
|
|
|
|
|
"root logger's name is printed as 'root' in the logged output."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"La racine de la hiérarchie des `loggers` est appelée le *root logger*. "
|
|
|
|
|
"C'est le `logger` utilisé par les fonctions :func:`debug`, :func:`info`, :"
|
|
|
|
|
"func:`warning`, :func:`error` et :func:`critical`, qui appelle en fait les "
|
|
|
|
|
"méthodes du mêmes nom de l'objet *root logger*. Les fonctions et les "
|
|
|
|
|
"méthodes ont la même signature. Le nom du *root logger* est affiché comme « "
|
|
|
|
|
"`root` » dans la sortie."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:376
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"It is, of course, possible to log messages to different destinations. "
|
|
|
|
|
"Support is included in the package for writing log messages to files, HTTP "
|
|
|
|
|
"GET/POST locations, email via SMTP, generic sockets, queues, or OS-specific "
|
|
|
|
|
"logging mechanisms such as syslog or the Windows NT event log. Destinations "
|
|
|
|
|
"are served by :dfn:`handler` classes. You can create your own log "
|
|
|
|
|
"destination class if you have special requirements not met by any of the "
|
|
|
|
|
"built-in handler classes."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Il est bien sûr possible d'enregistrer des messages pour des destinations "
|
|
|
|
|
"différentes. Ce paquet permet d'écrire des entrées de journal dans des "
|
|
|
|
|
"fichiers, des ressources HTTP GET/POST, par courriel via SMTP, des *sockets* "
|
|
|
|
|
"génériques, des files d'attente, ou des mécanismes d'enregistrement "
|
|
|
|
|
"spécifiques au système d'exploitation, comme *syslog* ou le journal "
|
|
|
|
|
"d'événements de Windows NT. Les destinations sont servies par des classes :"
|
|
|
|
|
"dfn:`handler`. Vous pouvez créer votre propre classe de destination si vous "
|
|
|
|
|
"avez des besoins spéciaux qui ne sont couverts par aucune classe *handler* "
|
|
|
|
|
"prédéfinie."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:383
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"By default, no destination is set for any logging messages. You can specify "
|
|
|
|
|
"a destination (such as console or file) by using :func:`basicConfig` as in "
|
|
|
|
|
"the tutorial examples. If you call the functions :func:`debug`, :func:"
|
|
|
|
|
"`info`, :func:`warning`, :func:`error` and :func:`critical`, they will check "
|
|
|
|
|
"to see if no destination is set; and if one is not set, they will set a "
|
|
|
|
|
"destination of the console (``sys.stderr``) and a default format for the "
|
|
|
|
|
"displayed message before delegating to the root logger to do the actual "
|
|
|
|
|
"message output."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Par défaut, aucune destination n'est prédéfinie pour les messages de "
|
|
|
|
|
"journalisation. Vous pouvez définir une destination (comme la console ou un "
|
|
|
|
|
"fichier) en utilisant :func:`basicConfig` comme dans les exemples donnés "
|
|
|
|
|
"dans le tutoriels. Si vous appelez les fonctions :func:`debug`, :func:"
|
|
|
|
|
"`info`, :func:`warning`, :func:`error` et :func:`critical`, celles-ci "
|
|
|
|
|
"vérifient si une destination a été définie ; si ce n'est pas le cas, la "
|
|
|
|
|
"destination est assignée à la console (``sys.stderr``) avec un format par "
|
|
|
|
|
"défaut pour le message affiché, avant d'être déléguée au *logger* racine, "
|
|
|
|
|
"qui sort le message."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:391
|
|
|
|
|
msgid "The default format set by :func:`basicConfig` for messages is:"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Le format par défaut des messages est défini par :func:`basicConfig` comme "
|
|
|
|
|
"suit : ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:397
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"You can change this by passing a format string to :func:`basicConfig` with "
|
|
|
|
|
"the *format* keyword argument. For all options regarding how a format string "
|
|
|
|
|
"is constructed, see :ref:`formatter-objects`."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Vous pouvez modifier ce comportement en passant une chaîne de formatage à :"
|
|
|
|
|
"func:`basicConfig` par l'argument nommé *format*. Voyez :ref:`formatter-"
|
|
|
|
|
"objects` pour toutes les options de construction de cette chaîne de "
|
|
|
|
|
"formatage."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:402
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Logging Flow"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Flux du processus de journalisation"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:404
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The flow of log event information in loggers and handlers is illustrated in "
|
|
|
|
|
"the following diagram."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Le flux des informations associées à un évènement dans les `loggers` et les "
|
|
|
|
|
"`handlers` est illustré dans le diagramme suivant."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:410
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Loggers"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Loggers"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:412
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`Logger` objects have a threefold job. First, they expose several "
|
|
|
|
|
"methods to application code so that applications can log messages at "
|
|
|
|
|
"runtime. Second, logger objects determine which log messages to act upon "
|
|
|
|
|
"based upon severity (the default filtering facility) or filter objects. "
|
|
|
|
|
"Third, logger objects pass along relevant log messages to all interested log "
|
|
|
|
|
"handlers."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Les objets de classe :class:`Logger` ont un rôle triple. Premièrement, ils "
|
|
|
|
|
"exposent plusieurs méthodes au code de l'application, de manière à ce "
|
|
|
|
|
"qu'elle puisse enregistrer des messages en cours d'exécution. Deuxièmement, "
|
|
|
|
|
"les objets `logger` déterminent sur quel message agir selon leur sévérité (à "
|
|
|
|
|
"partir des filtres par défaut) ou selon les objets `filter` associés. "
|
|
|
|
|
"Troisièmement, les objets `logger` transmettent les messages pertinents à "
|
|
|
|
|
"tous les `handlers` concernés."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:418
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The most widely used methods on logger objects fall into two categories: "
|
|
|
|
|
"configuration and message sending."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Les méthodes des objets `logger` les plus utilisées appartiennent à deux "
|
|
|
|
|
"catégories : la configuration et l'envoi de messages."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:421
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "These are the most common configuration methods:"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Voici les méthodes de configuration les plus communes :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:423
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":meth:`Logger.setLevel` specifies the lowest-severity log message a logger "
|
|
|
|
|
"will handle, where debug is the lowest built-in severity level and critical "
|
|
|
|
|
"is the highest built-in severity. For example, if the severity level is "
|
|
|
|
|
"INFO, the logger will handle only INFO, WARNING, ERROR, and CRITICAL "
|
|
|
|
|
"messages and will ignore DEBUG messages."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
":meth:`Logger.setLevel` spécifie le plus bas niveau de sévérité qu'un "
|
|
|
|
|
"`logger` traitera. Ainsi, `debug` est le niveau de sévérité défini par "
|
|
|
|
|
"défaut le plus bas, et `critical` le plus haut. Par exemple, si le niveau de "
|
|
|
|
|
"sévérité est INFO, le `logger` ne traite que les message de niveau INFO, "
|
|
|
|
|
"WARNING, ERROR et CRITICAL, et ignore les messages de niveau DEBUG."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:429
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":meth:`Logger.addHandler` and :meth:`Logger.removeHandler` add and remove "
|
|
|
|
|
"handler objects from the logger object. Handlers are covered in more detail "
|
|
|
|
|
"in :ref:`handler-basic`."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
":meth:`Logger.addHandler` et :meth:`Logger.removeHandler` ajoutent ou "
|
|
|
|
|
"enlèvent des objets `handlers` au `logger`. Les objets `handlers` sont "
|
|
|
|
|
"expliqués plus en détail dans :ref:`handler-basic`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:433
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":meth:`Logger.addFilter` and :meth:`Logger.removeFilter` add and remove "
|
|
|
|
|
"filter objects from the logger object. Filters are covered in more detail "
|
|
|
|
|
"in :ref:`filter`."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
":meth:`Logger.addFilter` et :meth:`Logger.removeFilter` ajoutent ou enlèvent "
|
|
|
|
|
"des objets `filter` au `logger`. Les objets `filters` sont expliqués plus "
|
|
|
|
|
"en détail dans :ref:`filter`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:437
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"You don't need to always call these methods on every logger you create. See "
|
|
|
|
|
"the last two paragraphs in this section."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Comme nous l'expliquons aux deux derniers paragraphes de cette section, vous "
|
|
|
|
|
"n'avez pas besoin de faire appel à ces méthodes à chaque fois que vous créez "
|
|
|
|
|
"un `logger`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:440
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"With the logger object configured, the following methods create log messages:"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Une fois que l'objet `logger` est correctement configuré, les méthodes "
|
|
|
|
|
"suivantes permettent de créer un message :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:442
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":meth:`Logger.debug`, :meth:`Logger.info`, :meth:`Logger.warning`, :meth:"
|
|
|
|
|
"`Logger.error`, and :meth:`Logger.critical` all create log records with a "
|
|
|
|
|
"message and a level that corresponds to their respective method names. The "
|
|
|
|
|
"message is actually a format string, which may contain the standard string "
|
|
|
|
|
"substitution syntax of ``%s``, ``%d``, ``%f``, and so on. The rest of their "
|
|
|
|
|
"arguments is a list of objects that correspond with the substitution fields "
|
|
|
|
|
"in the message. With regard to ``**kwargs``, the logging methods care only "
|
|
|
|
|
"about a keyword of ``exc_info`` and use it to determine whether to log "
|
|
|
|
|
"exception information."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Les méthodes :meth:`Logger.debug`, :meth:`Logger.info`, :meth:`Logger."
|
|
|
|
|
"warning`, :meth:`Logger.error`, et :meth:`Logger.critical`créent des entrées "
|
|
|
|
|
"de journal avec un message et un niveau correspondant à leur nom. Le message "
|
|
|
|
|
"est en fait une chaîne de caractère qui peut contenir la syntaxe standard "
|
|
|
|
|
"de substitution de chaînes de caractères : ``%s``, ``%d``, ``%f``, etc. "
|
|
|
|
|
"L'argument suivant est une liste des objets correspondant aux champs à "
|
|
|
|
|
"substituer dans le message. En ce qui concerne ``**kwargs``, les méthodes de "
|
|
|
|
|
"`logging` ne tiennent compte que du mot clef ``exc_info`` et l'utilisent "
|
|
|
|
|
"pour déterminer s'il faut enregistrer les informations associées à une "
|
|
|
|
|
"exception."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:452
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":meth:`Logger.exception` creates a log message similar to :meth:`Logger."
|
|
|
|
|
"error`. The difference is that :meth:`Logger.exception` dumps a stack trace "
|
|
|
|
|
"along with it. Call this method only from an exception handler."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
":meth:`Logger.exception` crée un message similaire à :meth:`Logger.error`. "
|
|
|
|
|
"La différence est que :meth:`Logger.exception` ajoute la trace de la pile "
|
|
|
|
|
"d'exécution au message. On ne peut appeler cette méthode qu'à l'intérieur "
|
|
|
|
|
"d'un bloc de gestion d'exception."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:456
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":meth:`Logger.log` takes a log level as an explicit argument. This is a "
|
|
|
|
|
"little more verbose for logging messages than using the log level "
|
|
|
|
|
"convenience methods listed above, but this is how to log at custom log "
|
|
|
|
|
"levels."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
":meth:`Logger.log` prend le niveau de sévérité comme argument explicite. "
|
|
|
|
|
"C'est un peu plus verbeux pour enregistrer des messages que d'utiliser les "
|
|
|
|
|
"méthodes plus pratiques décrites si dessus, mais c'est ce qui permet "
|
|
|
|
|
"d'enregistrer des messages pour des niveaux de sévérité définis par "
|
|
|
|
|
"l'utilisateur."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:460
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":func:`getLogger` returns a reference to a logger instance with the "
|
|
|
|
|
"specified name if it is provided, or ``root`` if not. The names are period-"
|
|
|
|
|
"separated hierarchical structures. Multiple calls to :func:`getLogger` with "
|
|
|
|
|
"the same name will return a reference to the same logger object. Loggers "
|
|
|
|
|
"that are further down in the hierarchical list are children of loggers "
|
|
|
|
|
"higher up in the list. For example, given a logger with a name of ``foo``, "
|
|
|
|
|
"loggers with names of ``foo.bar``, ``foo.bar.baz``, and ``foo.bam`` are all "
|
|
|
|
|
"descendants of ``foo``."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
":func:`getLogger` renvoie une référence à un objet `logger` du nom spécifié "
|
|
|
|
|
"si celui-ci est donné en argument. Dans le cas contraire, se sera le `logger "
|
|
|
|
|
"root`. Ces noms sont des structures hiérarchiques séparées par des points. "
|
|
|
|
|
"Des appels répétés à :func:`getLogger` avec le même nom renvoient une "
|
|
|
|
|
"référence au même objet `logger`. Les `loggers` qui sont plus bas dans cette "
|
|
|
|
|
"liste hiérarchique sont des enfants des `loggers` plus haut dans la liste. "
|
|
|
|
|
"Par exemple, si un `logger` a le nom ``foo``, les `loggers` avec les noms "
|
|
|
|
|
"``foo.bar``, ``foo.bar.baz``, et ``foo.bam`` sont tous des descendants de "
|
|
|
|
|
"``foo``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:468
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Loggers have a concept of *effective level*. If a level is not explicitly "
|
|
|
|
|
"set on a logger, the level of its parent is used instead as its effective "
|
|
|
|
|
"level. If the parent has no explicit level set, *its* parent is examined, "
|
|
|
|
|
"and so on - all ancestors are searched until an explicitly set level is "
|
|
|
|
|
"found. The root logger always has an explicit level set (``WARNING`` by "
|
|
|
|
|
"default). When deciding whether to process an event, the effective level of "
|
|
|
|
|
"the logger is used to determine whether the event is passed to the logger's "
|
|
|
|
|
"handlers."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"On associe aux `loggers` un concept de *niveau effectif*. Si aucun niveau "
|
|
|
|
|
"n'est explicitement défini pour un `logger`, c'est le niveau du parent qui "
|
|
|
|
|
"est utilisé comme niveau effectif. Si le parent n'a pas de niveau défini, "
|
|
|
|
|
"c'est celui de *son* parent qui est considéré, et ainsi de suite ; on "
|
|
|
|
|
"examine tous les ancêtres jusqu'à ce qu'un niveau explicite soit trouvé. Le "
|
|
|
|
|
"`logger root` a toujours un niveau explicite (``WARNING`` par défaut). Quand "
|
|
|
|
|
"le `logger` traite un événement, c'est ce niveau effectif qui est utilisé "
|
|
|
|
|
"pour déterminer si cet événement est transmis à ses `handlers`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:476
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Child loggers propagate messages up to the handlers associated with their "
|
|
|
|
|
"ancestor loggers. Because of this, it is unnecessary to define and configure "
|
|
|
|
|
"handlers for all the loggers an application uses. It is sufficient to "
|
|
|
|
|
"configure handlers for a top-level logger and create child loggers as "
|
|
|
|
|
"needed. (You can, however, turn off propagation by setting the *propagate* "
|
|
|
|
|
"attribute of a logger to ``False``.)"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Les `loggers` fils font remonter leurs messages aux `handlers` associés à "
|
|
|
|
|
"leurs `loggers` ancêtres. De ce fait, il n'est pas nécessaire de définir et "
|
|
|
|
|
"configurer des `handlers` pour tous les `loggers` employés par une "
|
|
|
|
|
"application. Il suffit de configurer les `handlers` pour un `logger` de haut "
|
|
|
|
|
"niveau et de créer des `loggers` fils quand c'est nécessaire (on peut "
|
|
|
|
|
"cependant empêcher la propagation aux ancêtres des messages en donnant la "
|
|
|
|
|
"valeur ``False`` à l'attribut *propagate* d'un `logger`)."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:487
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Handlers"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Handlers"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:489
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`~logging.Handler` objects are responsible for dispatching the "
|
|
|
|
|
"appropriate log messages (based on the log messages' severity) to the "
|
|
|
|
|
"handler's specified destination. :class:`Logger` objects can add zero or "
|
|
|
|
|
"more handler objects to themselves with an :meth:`~Logger.addHandler` "
|
|
|
|
|
"method. As an example scenario, an application may want to send all log "
|
|
|
|
|
"messages to a log file, all log messages of error or higher to stdout, and "
|
|
|
|
|
"all messages of critical to an email address. This scenario requires three "
|
|
|
|
|
"individual handlers where each handler is responsible for sending messages "
|
|
|
|
|
"of a specific severity to a specific location."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Les objets de type :class:`~logging.Handler` sont responsables de la "
|
|
|
|
|
"distribution des messages (selon leur niveau de sévérité) vers les "
|
|
|
|
|
"destinations spécifiées pour ce `handler`. Les objets :class:`Logger` "
|
|
|
|
|
"peuvent ajouter des objets `handler` à eux-mêmes en appelant :meth:`~Logger."
|
|
|
|
|
"addHandler`. Pour donner un exemple, une application peut envoyer tous les "
|
|
|
|
|
"messages dans un fichier journal, tous les messages de niveau `error` ou "
|
|
|
|
|
"supérieur vers la sortie standard, et tous les messages de niveau `critical` "
|
|
|
|
|
"vers une adresse de courriel. Dans ce scenario, nous avons besoin de trois "
|
|
|
|
|
"`handlers`, responsable chacun d'envoyer des messages d'une sévérité donnée "
|
|
|
|
|
"vers une destination donnée."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:499
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The standard library includes quite a few handler types (see :ref:`useful-"
|
|
|
|
|
"handlers`); the tutorials use mainly :class:`StreamHandler` and :class:"
|
|
|
|
|
"`FileHandler` in its examples."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"La bibliothèque standard inclut déjà un bon nombre de types d'`handlers` "
|
|
|
|
|
"(voir :ref:`useful-handlers`) ; le tutoriel utilise surtout :class:"
|
|
|
|
|
"`StreamHandler` et :class:`FileHandler` dans ses exemples."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:503
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"There are very few methods in a handler for application developers to "
|
|
|
|
|
"concern themselves with. The only handler methods that seem relevant for "
|
|
|
|
|
"application developers who are using the built-in handler objects (that is, "
|
|
|
|
|
"not creating custom handlers) are the following configuration methods:"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Peu de méthodes des objets `handlers` sont intéressantes pour les "
|
|
|
|
|
"développeurs. Les seules méthodes intéressantes lorsqu'on utilise les objets "
|
|
|
|
|
"`handlers` natifs (c'est à dire si l'on ne crée pas d'`handler` "
|
|
|
|
|
"personnalisé) sont les méthodes de configuration suivantes : "
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:508
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The :meth:`~Handler.setLevel` method, just as in logger objects, specifies "
|
|
|
|
|
"the lowest severity that will be dispatched to the appropriate destination. "
|
|
|
|
|
"Why are there two :func:`setLevel` methods? The level set in the logger "
|
|
|
|
|
"determines which severity of messages it will pass to its handlers. The "
|
|
|
|
|
"level set in each handler determines which messages that handler will send "
|
|
|
|
|
"on."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"La méthode :meth:`~Handler.setLevel`, comme celle des objets `logger` permet "
|
|
|
|
|
"de spécifier le plus bas niveau de sévérité qui sera distribué à la "
|
|
|
|
|
"destination appropriée. Pourquoi y a-t-il deux méthodes :func:`setLevel` ? "
|
|
|
|
|
"Le niveau défini dans le `logger` détermine quelle sévérité doit avoir un "
|
|
|
|
|
"message pour être transmis à ses `handlers`. Le niveau mis pour chaque "
|
|
|
|
|
"`handler` détermine quels messages seront envoyés aux destinations."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:514
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":meth:`~Handler.setFormatter` selects a Formatter object for this handler to "
|
|
|
|
|
"use."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
":meth:`~Handler.setFormatter` sélectionne l'objet `Formatter` utilisé par "
|
|
|
|
|
"cet `handler`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:517
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":meth:`~Handler.addFilter` and :meth:`~Handler.removeFilter` respectively "
|
|
|
|
|
"configure and deconfigure filter objects on handlers."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
":meth:`~Handler.addFilter` et :meth:`~Handler.removeFilter` configurent et "
|
|
|
|
|
"respectivement dé-configurent des objets `filter` sur les `handlers`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:520
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Application code should not directly instantiate and use instances of :class:"
|
|
|
|
|
"`Handler`. Instead, the :class:`Handler` class is a base class that defines "
|
|
|
|
|
"the interface that all handlers should have and establishes some default "
|
|
|
|
|
"behavior that child classes can use (or override)."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Le code d'une application ne devrait ni instancier, ni utiliser d'instances "
|
|
|
|
|
"de la classe :class:`Handler`. La classe :class:`Handler` est plutôt d'une "
|
|
|
|
|
"classe de base qui défini l'interface que tous les `handlers` doivent avoir, "
|
|
|
|
|
"et établi les comportements par défaut que les classes filles peuvent "
|
|
|
|
|
"employer (ou redéfinir)."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:527
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Formatters"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Formatters"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:529
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Formatter objects configure the final order, structure, and contents of the "
|
|
|
|
|
"log message. Unlike the base :class:`logging.Handler` class, application "
|
|
|
|
|
"code may instantiate formatter classes, although you could likely subclass "
|
|
|
|
|
"the formatter if your application needs special behavior. The constructor "
|
|
|
|
|
"takes three optional arguments -- a message format string, a date format "
|
|
|
|
|
"string and a style indicator."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Les objets `formatter` configurent l'ordre final, la structure et le contenu "
|
|
|
|
|
"du message. Contrairement à la classe de base :class:`logging.Handler`, le "
|
|
|
|
|
"code d'une application peut instancier un objet de classe `formatter`, même "
|
|
|
|
|
"si vous pouvez toujours sous-classer `formatter` si vous avez besoin d'un "
|
|
|
|
|
"comportement spécial dans votre application. Le constructeur a trois "
|
|
|
|
|
"arguments optionnels : une chaîne de formatage du message, un chaîne de "
|
|
|
|
|
"formatage de la date et un indicateur de style."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:538
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"If there is no message format string, the default is to use the raw "
|
2018-04-28 22:28:01 +00:00
|
|
|
|
"message. If there is no date format string, the default date format is:"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"S'il n'y a pas de chaîne de formatage, la chaîne brute est utilisée par "
|
|
|
|
|
"défaut. S'il n'y a pas de chaîne de formatage de date, le format de date par "
|
|
|
|
|
"défaut est :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:545
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"with the milliseconds tacked on at the end. The ``style`` is one of `%`, '{' "
|
|
|
|
|
"or '$'. If one of these is not specified, then '%' will be used."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"avec les millisecondes en suffixe. Le ``style`` est `%`, `{` ou `$`. Si "
|
|
|
|
|
"aucun n'est spécifié, `%` sera utilisé."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:548
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"If the ``style`` is '%', the message format string uses ``%(<dictionary "
|
|
|
|
|
"key>)s`` styled string substitution; the possible keys are documented in :"
|
|
|
|
|
"ref:`logrecord-attributes`. If the style is '{', the message format string "
|
|
|
|
|
"is assumed to be compatible with :meth:`str.format` (using keyword "
|
|
|
|
|
"arguments), while if the style is '$' then the message format string should "
|
|
|
|
|
"conform to what is expected by :meth:`string.Template.substitute`."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Si l'argument ``style`` est `%`, la chaîne de formatage utilise ``%(<clef de "
|
|
|
|
|
"dictionnaire>)s`` comme style de substitution de chaîne de caractères ; les "
|
|
|
|
|
"clefs possibles sont documentées dans :ref:`logrecord-attributes`. Si le "
|
|
|
|
|
"style est `{`, le message de la chaîne de formatage est compatible avec :"
|
|
|
|
|
"meth:`str.format` (en employant des arguments à mots clefs). Enfin si le "
|
|
|
|
|
"style est `$` alors la chaîne de formatage du message doit être conforme à "
|
|
|
|
|
"ce qui est attendu de :meth:`string.Template.substitute`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:555
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Added the ``style`` parameter."
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Ajout du paramètre ``style``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:558
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The following message format string will log the time in a human-readable "
|
|
|
|
|
"format, the severity of the message, and the contents of the message, in "
|
|
|
|
|
"that order::"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Le chaîne de formatage de message suivante enregistrera le temps dans un "
|
|
|
|
|
"format lisible par les humains, la sévérité du message et son contenu, dans "
|
|
|
|
|
"cet ordre ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:564
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Formatters use a user-configurable function to convert the creation time of "
|
|
|
|
|
"a record to a tuple. By default, :func:`time.localtime` is used; to change "
|
|
|
|
|
"this for a particular formatter instance, set the ``converter`` attribute of "
|
|
|
|
|
"the instance to a function with the same signature as :func:`time.localtime` "
|
|
|
|
|
"or :func:`time.gmtime`. To change it for all formatters, for example if you "
|
|
|
|
|
"want all logging times to be shown in GMT, set the ``converter`` attribute "
|
|
|
|
|
"in the Formatter class (to ``time.gmtime`` for GMT display)."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Les `formatters` emploient une fonction configurable par l'utilisateur pour "
|
|
|
|
|
"convertir le temps de création d'une entrée de journal en un tuple. Par "
|
|
|
|
|
"défaut, :func:`time.localtime` est employé ; pour changer cela pour une "
|
|
|
|
|
"instance particulière de `formatter`, assignez une fonction avec la même "
|
|
|
|
|
"signature que :func:`time.localtime` ou :func:`time.gmtime` à l'attribut "
|
|
|
|
|
"``converter`` de cette instance. Pour changer cela pour tous les "
|
|
|
|
|
"`formatters`, par exemple si vous voulez que tous votre horodatage soit "
|
|
|
|
|
"affiché en GMT, changez l'attribut ``converter`` de la classe ``Formatter`` "
|
|
|
|
|
"en ``time.gmtime``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:574
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Configuring Logging"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Configuration de `Logging`"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:578
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Programmers can configure logging in three ways:"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "On peut configurer `logging` de trois façons : "
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:580
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Creating loggers, handlers, and formatters explicitly using Python code that "
|
|
|
|
|
"calls the configuration methods listed above."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Créer des `loggers`, `handlers` et `formatters` explicitement en utilisant "
|
|
|
|
|
"du code Python qui appelle les méthodes de configuration listées ci-dessus."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:582
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Creating a logging config file and reading it using the :func:`fileConfig` "
|
|
|
|
|
"function."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Créer un ficher de configuration de `logging` et le lire en employant la "
|
|
|
|
|
"fonction :func:`fileConfig`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:584
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Creating a dictionary of configuration information and passing it to the :"
|
|
|
|
|
"func:`dictConfig` function."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Créer un dictionnaire d'informations de configuration et le passer à la "
|
|
|
|
|
"fonction :func:`dictConfig`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:587
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"For the reference documentation on the last two options, see :ref:`logging-"
|
|
|
|
|
"config-api`. The following example configures a very simple logger, a "
|
|
|
|
|
"console handler, and a simple formatter using Python code::"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Pour la documentation de référence de ces deux dernières options, voyez :ref:"
|
|
|
|
|
"`logging-config-api`. L'exemple suivant configure un `logger` très simple, "
|
|
|
|
|
"un `handler` employant la console, et un `formatter` simple en utilisant du "
|
|
|
|
|
"code Python ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:617
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Running this module from the command line produces the following output:"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"L'exécution de ce module via la ligne de commande produit la sortie "
|
|
|
|
|
"suivante :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:628
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The following Python module creates a logger, handler, and formatter nearly "
|
|
|
|
|
"identical to those in the example listed above, with the only difference "
|
|
|
|
|
"being the names of the objects::"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Le module Python suivant crée un *logger*, un *handler* et un *formatter* "
|
|
|
|
|
"identiques à ceux de l'exemple détaillé au dessus, au nom des objets "
|
|
|
|
|
"près : ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:647
|
|
|
|
|
msgid "Here is the logging.conf file:"
|
2018-11-13 13:13:06 +00:00
|
|
|
|
msgstr "Voici le fichier *logging.conf* :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:680
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The output is nearly identical to that of the non-config-file-based example:"
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"La sortie est presque identique à celle de l'exemple qui n'est pas basé sur "
|
|
|
|
|
"un fichier de configuration :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:691
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"You can see that the config file approach has a few advantages over the "
|
|
|
|
|
"Python code approach, mainly separation of configuration and code and the "
|
|
|
|
|
"ability of noncoders to easily modify the logging properties."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Vous pouvez constatez les avantages de l'approche par fichier de "
|
|
|
|
|
"configuration par rapport à celle du code Python, principalement la "
|
|
|
|
|
"séparation de la configuration et du code, et la possibilité pour une "
|
|
|
|
|
"personne qui ne code pas de modifier facilement les propriétés de `logging`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:695
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The :func:`fileConfig` function takes a default parameter, "
|
|
|
|
|
"``disable_existing_loggers``, which defaults to ``True`` for reasons of "
|
|
|
|
|
"backward compatibility. This may or may not be what you want, since it will "
|
|
|
|
|
"cause any loggers existing before the :func:`fileConfig` call to be disabled "
|
|
|
|
|
"unless they (or an ancestor) are explicitly named in the configuration. "
|
|
|
|
|
"Please refer to the reference documentation for more information, and "
|
|
|
|
|
"specify ``False`` for this parameter if you wish."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"La fonction :func:`fileConfig` accepte un paramètre par défaut "
|
|
|
|
|
"``disable_existing_loggers``, qui vaut ``True`` par défaut pour des raisons "
|
|
|
|
|
"de compatibilité ascendante. Ce n'est pas forcément ce que vous souhaitez : "
|
|
|
|
|
"en effet, tout les *loggers* créés avant l'appel à :func:`fileConfig` seront "
|
|
|
|
|
"désactivés sauf si eux-mêmes (ou l'un de leurs ancêtres) sont explicitement "
|
|
|
|
|
"nommés dans le fichier de configuration. Veuillez vous rapporter à la "
|
|
|
|
|
"documentation pour plus de détails, et donner la valeur ``False`` à ce "
|
|
|
|
|
"paramètre si vous le souhaitez."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:703
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The dictionary passed to :func:`dictConfig` can also specify a Boolean value "
|
|
|
|
|
"with key ``disable_existing_loggers``, which if not specified explicitly in "
|
|
|
|
|
"the dictionary also defaults to being interpreted as ``True``. This leads "
|
|
|
|
|
"to the logger-disabling behaviour described above, which may not be what you "
|
|
|
|
|
"want - in which case, provide the key explicitly with a value of ``False``."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Le dictionnaire passé à :func:`dictConfig` peut aussi spécifier une valeur "
|
|
|
|
|
"Booléenne pour la clef ``disable_existing_loggers``. Si cette valeur n'est "
|
|
|
|
|
"pas donnée, elle est interprétée comme vraie par défaut. Cela conduit au "
|
|
|
|
|
"comportement de désactivation des *loggers* décrit ci-dessus, qui n'est pas "
|
|
|
|
|
"forcément celui que vous souhaitez ; dans ce cas, donnez explicitement la "
|
|
|
|
|
"valeur ``False`` à cette clef."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:713
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Note that the class names referenced in config files need to be either "
|
|
|
|
|
"relative to the logging module, or absolute values which can be resolved "
|
|
|
|
|
"using normal import mechanisms. Thus, you could use either :class:`~logging."
|
|
|
|
|
"handlers.WatchedFileHandler` (relative to the logging module) or ``mypackage."
|
|
|
|
|
"mymodule.MyHandler`` (for a class defined in package ``mypackage`` and "
|
|
|
|
|
"module ``mymodule``, where ``mypackage`` is available on the Python import "
|
|
|
|
|
"path)."
|
|
|
|
|
msgstr ""
|
2018-11-13 13:13:06 +00:00
|
|
|
|
"Notez que les noms de classe référencés dans le fichier de configuration "
|
|
|
|
|
"doivent être relatifs aux module `logging`, ou des valeurs absolues qui "
|
|
|
|
|
"peuvent être résolues à travers les mécanismes d'importation habituels. "
|
|
|
|
|
"Ainsi, on peut soit utiliser :class:`~logging.handlers.WatchedFileHandler` "
|
|
|
|
|
"(relativement au module `logging`) ou ``mypackage.mymodule.MyHandler`` (pour "
|
|
|
|
|
"une classe définie dans le paquet ``mypackage`` et le module ``mymodule``, "
|
|
|
|
|
"si ``mypackage`` est disponible dans les chemins d'importation de Python)."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:721
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"In Python 3.2, a new means of configuring logging has been introduced, using "
|
|
|
|
|
"dictionaries to hold configuration information. This provides a superset of "
|
|
|
|
|
"the functionality of the config-file-based approach outlined above, and is "
|
|
|
|
|
"the recommended configuration method for new applications and deployments. "
|
|
|
|
|
"Because a Python dictionary is used to hold configuration information, and "
|
|
|
|
|
"since you can populate that dictionary using different means, you have more "
|
|
|
|
|
"options for configuration. For example, you can use a configuration file in "
|
|
|
|
|
"JSON format, or, if you have access to YAML processing functionality, a file "
|
|
|
|
|
"in YAML format, to populate the configuration dictionary. Or, of course, you "
|
|
|
|
|
"can construct the dictionary in Python code, receive it in pickled form over "
|
|
|
|
|
"a socket, or use whatever approach makes sense for your application."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:733
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Here's an example of the same configuration as above, in YAML format for the "
|
2018-04-28 22:28:01 +00:00
|
|
|
|
"new dictionary-based approach:"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:757
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"For more information about logging using a dictionary, see :ref:`logging-"
|
|
|
|
|
"config-api`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:761
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "What happens if no configuration is provided"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:763
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"If no logging configuration is provided, it is possible to have a situation "
|
|
|
|
|
"where a logging event needs to be output, but no handlers can be found to "
|
|
|
|
|
"output the event. The behaviour of the logging package in these "
|
|
|
|
|
"circumstances is dependent on the Python version."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:768
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "For versions of Python prior to 3.2, the behaviour is as follows:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:770
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"If *logging.raiseExceptions* is ``False`` (production mode), the event is "
|
|
|
|
|
"silently dropped."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:773
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"If *logging.raiseExceptions* is ``True`` (development mode), a message 'No "
|
|
|
|
|
"handlers could be found for logger X.Y.Z' is printed once."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:776
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "In Python 3.2 and later, the behaviour is as follows:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:778
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The event is output using a 'handler of last resort', stored in ``logging."
|
|
|
|
|
"lastResort``. This internal handler is not associated with any logger, and "
|
|
|
|
|
"acts like a :class:`~logging.StreamHandler` which writes the event "
|
|
|
|
|
"description message to the current value of ``sys.stderr`` (therefore "
|
|
|
|
|
"respecting any redirections which may be in effect). No formatting is done "
|
|
|
|
|
"on the message - just the bare event description message is printed. The "
|
|
|
|
|
"handler's level is set to ``WARNING``, so all events at this and greater "
|
|
|
|
|
"severities will be output."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:787
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"To obtain the pre-3.2 behaviour, ``logging.lastResort`` can be set to "
|
|
|
|
|
"``None``."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:792
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Configuring Logging for a Library"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:794
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"When developing a library which uses logging, you should take care to "
|
|
|
|
|
"document how the library uses logging - for example, the names of loggers "
|
|
|
|
|
"used. Some consideration also needs to be given to its logging "
|
|
|
|
|
"configuration. If the using application does not use logging, and library "
|
|
|
|
|
"code makes logging calls, then (as described in the previous section) events "
|
|
|
|
|
"of severity ``WARNING`` and greater will be printed to ``sys.stderr``. This "
|
|
|
|
|
"is regarded as the best default behaviour."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:802
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"If for some reason you *don't* want these messages printed in the absence of "
|
|
|
|
|
"any logging configuration, you can attach a do-nothing handler to the top-"
|
|
|
|
|
"level logger for your library. This avoids the message being printed, since "
|
|
|
|
|
"a handler will be always be found for the library's events: it just doesn't "
|
|
|
|
|
"produce any output. If the library user configures logging for application "
|
|
|
|
|
"use, presumably that configuration will add some handlers, and if levels are "
|
|
|
|
|
"suitably configured then logging calls made in library code will send output "
|
|
|
|
|
"to those handlers, as normal."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:811
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"A do-nothing handler is included in the logging package: :class:`~logging."
|
|
|
|
|
"NullHandler` (since Python 3.1). An instance of this handler could be added "
|
|
|
|
|
"to the top-level logger of the logging namespace used by the library (*if* "
|
|
|
|
|
"you want to prevent your library's logged events being output to ``sys."
|
|
|
|
|
"stderr`` in the absence of logging configuration). If all logging by a "
|
|
|
|
|
"library *foo* is done using loggers with names matching 'foo.x', 'foo.x.y', "
|
|
|
|
|
"etc. then the code::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:822
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"should have the desired effect. If an organisation produces a number of "
|
|
|
|
|
"libraries, then the logger name specified can be 'orgname.foo' rather than "
|
|
|
|
|
"just 'foo'."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:826
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"It is strongly advised that you *do not add any handlers other than* :class:"
|
|
|
|
|
"`~logging.NullHandler` *to your library's loggers*. This is because the "
|
|
|
|
|
"configuration of handlers is the prerogative of the application developer "
|
|
|
|
|
"who uses your library. The application developer knows their target audience "
|
|
|
|
|
"and what handlers are most appropriate for their application: if you add "
|
|
|
|
|
"handlers 'under the hood', you might well interfere with their ability to "
|
|
|
|
|
"carry out unit tests and deliver logs which suit their requirements."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:837
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Logging Levels"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:839
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The numeric values of logging levels are given in the following table. These "
|
|
|
|
|
"are primarily of interest if you want to define your own levels, and need "
|
|
|
|
|
"them to have specific values relative to the predefined levels. If you "
|
|
|
|
|
"define a level with the same numeric value, it overwrites the predefined "
|
|
|
|
|
"value; the predefined name is lost."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:846
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Numeric value"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:848
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "50"
|
|
|
|
|
msgstr "50"
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:850
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "40"
|
|
|
|
|
msgstr "40"
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:852
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "30"
|
|
|
|
|
msgstr "30"
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:854
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "20"
|
|
|
|
|
msgstr "20"
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:856
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "10"
|
|
|
|
|
msgstr "10"
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:858
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "``NOTSET``"
|
|
|
|
|
msgstr "``NOTSET``"
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:858
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "0"
|
|
|
|
|
msgstr "0"
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:861
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Levels can also be associated with loggers, being set either by the "
|
|
|
|
|
"developer or through loading a saved logging configuration. When a logging "
|
|
|
|
|
"method is called on a logger, the logger compares its own level with the "
|
|
|
|
|
"level associated with the method call. If the logger's level is higher than "
|
|
|
|
|
"the method call's, no logging message is actually generated. This is the "
|
|
|
|
|
"basic mechanism controlling the verbosity of logging output."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:868
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Logging messages are encoded as instances of the :class:`~logging.LogRecord` "
|
|
|
|
|
"class. When a logger decides to actually log an event, a :class:`~logging."
|
|
|
|
|
"LogRecord` instance is created from the logging message."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:872
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Logging messages are subjected to a dispatch mechanism through the use of :"
|
|
|
|
|
"dfn:`handlers`, which are instances of subclasses of the :class:`Handler` "
|
|
|
|
|
"class. Handlers are responsible for ensuring that a logged message (in the "
|
|
|
|
|
"form of a :class:`LogRecord`) ends up in a particular location (or set of "
|
|
|
|
|
"locations) which is useful for the target audience for that message (such as "
|
|
|
|
|
"end users, support desk staff, system administrators, developers). Handlers "
|
|
|
|
|
"are passed :class:`LogRecord` instances intended for particular "
|
|
|
|
|
"destinations. Each logger can have zero, one or more handlers associated "
|
|
|
|
|
"with it (via the :meth:`~Logger.addHandler` method of :class:`Logger`). In "
|
|
|
|
|
"addition to any handlers directly associated with a logger, *all handlers "
|
|
|
|
|
"associated with all ancestors of the logger* are called to dispatch the "
|
|
|
|
|
"message (unless the *propagate* flag for a logger is set to a false value, "
|
|
|
|
|
"at which point the passing to ancestor handlers stops)."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:886
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Just as for loggers, handlers can have levels associated with them. A "
|
|
|
|
|
"handler's level acts as a filter in the same way as a logger's level does. "
|
|
|
|
|
"If a handler decides to actually dispatch an event, the :meth:`~Handler."
|
|
|
|
|
"emit` method is used to send the message to its destination. Most user-"
|
|
|
|
|
"defined subclasses of :class:`Handler` will need to override this :meth:"
|
|
|
|
|
"`~Handler.emit`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:895
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Custom Levels"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:897
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Defining your own levels is possible, but should not be necessary, as the "
|
|
|
|
|
"existing levels have been chosen on the basis of practical experience. "
|
|
|
|
|
"However, if you are convinced that you need custom levels, great care should "
|
|
|
|
|
"be exercised when doing this, and it is possibly *a very bad idea to define "
|
|
|
|
|
"custom levels if you are developing a library*. That's because if multiple "
|
|
|
|
|
"library authors all define their own custom levels, there is a chance that "
|
|
|
|
|
"the logging output from such multiple libraries used together will be "
|
|
|
|
|
"difficult for the using developer to control and/or interpret, because a "
|
|
|
|
|
"given numeric value might mean different things for different libraries."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:910
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Useful Handlers"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:912
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"In addition to the base :class:`Handler` class, many useful subclasses are "
|
|
|
|
|
"provided:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:915
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`StreamHandler` instances send messages to streams (file-like "
|
|
|
|
|
"objects)."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:918
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ":class:`FileHandler` instances send messages to disk files."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:920
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`~handlers.BaseRotatingHandler` is the base class for handlers that "
|
|
|
|
|
"rotate log files at a certain point. It is not meant to be instantiated "
|
|
|
|
|
"directly. Instead, use :class:`~handlers.RotatingFileHandler` or :class:"
|
|
|
|
|
"`~handlers.TimedRotatingFileHandler`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:925
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`~handlers.RotatingFileHandler` instances send messages to disk "
|
|
|
|
|
"files, with support for maximum log file sizes and log file rotation."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:928
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`~handlers.TimedRotatingFileHandler` instances send messages to disk "
|
|
|
|
|
"files, rotating the log file at certain timed intervals."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:931
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`~handlers.SocketHandler` instances send messages to TCP/IP sockets. "
|
|
|
|
|
"Since 3.4, Unix domain sockets are also supported."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:934
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`~handlers.DatagramHandler` instances send messages to UDP sockets. "
|
|
|
|
|
"Since 3.4, Unix domain sockets are also supported."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:937
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`~handlers.SMTPHandler` instances send messages to a designated email "
|
|
|
|
|
"address."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:940
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`~handlers.SysLogHandler` instances send messages to a Unix syslog "
|
|
|
|
|
"daemon, possibly on a remote machine."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:943
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`~handlers.NTEventLogHandler` instances send messages to a Windows "
|
|
|
|
|
"NT/2000/XP event log."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:946
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`~handlers.MemoryHandler` instances send messages to a buffer in "
|
|
|
|
|
"memory, which is flushed whenever specific criteria are met."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:949
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`~handlers.HTTPHandler` instances send messages to an HTTP server "
|
|
|
|
|
"using either ``GET`` or ``POST`` semantics."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:952
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`~handlers.WatchedFileHandler` instances watch the file they are "
|
|
|
|
|
"logging to. If the file changes, it is closed and reopened using the file "
|
|
|
|
|
"name. This handler is only useful on Unix-like systems; Windows does not "
|
|
|
|
|
"support the underlying mechanism used."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:957
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`~handlers.QueueHandler` instances send messages to a queue, such as "
|
|
|
|
|
"those implemented in the :mod:`queue` or :mod:`multiprocessing` modules."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:960
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`NullHandler` instances do nothing with error messages. They are used "
|
|
|
|
|
"by library developers who want to use logging, but want to avoid the 'No "
|
|
|
|
|
"handlers could be found for logger XXX' message which can be displayed if "
|
|
|
|
|
"the library user has not configured logging. See :ref:`library-config` for "
|
|
|
|
|
"more information."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:966
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "The :class:`NullHandler` class."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:969
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "The :class:`~handlers.QueueHandler` class."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:972
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The :class:`NullHandler`, :class:`StreamHandler` and :class:`FileHandler` "
|
|
|
|
|
"classes are defined in the core logging package. The other handlers are "
|
|
|
|
|
"defined in a sub- module, :mod:`logging.handlers`. (There is also another "
|
|
|
|
|
"sub-module, :mod:`logging.config`, for configuration functionality.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:977
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Logged messages are formatted for presentation through instances of the :"
|
|
|
|
|
"class:`Formatter` class. They are initialized with a format string suitable "
|
|
|
|
|
"for use with the % operator and a dictionary."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:981
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"For formatting multiple messages in a batch, instances of :class:`~handlers."
|
|
|
|
|
"BufferingFormatter` can be used. In addition to the format string (which is "
|
|
|
|
|
"applied to each message in the batch), there is provision for header and "
|
|
|
|
|
"trailer format strings."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:986
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"When filtering based on logger level and/or handler level is not enough, "
|
|
|
|
|
"instances of :class:`Filter` can be added to both :class:`Logger` and :class:"
|
|
|
|
|
"`Handler` instances (through their :meth:`~Handler.addFilter` method). "
|
|
|
|
|
"Before deciding to process a message further, both loggers and handlers "
|
|
|
|
|
"consult all their filters for permission. If any filter returns a false "
|
|
|
|
|
"value, the message is not processed further."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:993
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The basic :class:`Filter` functionality allows filtering by specific logger "
|
|
|
|
|
"name. If this feature is used, messages sent to the named logger and its "
|
|
|
|
|
"children are allowed through the filter, and all others dropped."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1001
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Exceptions raised during logging"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1003
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The logging package is designed to swallow exceptions which occur while "
|
|
|
|
|
"logging in production. This is so that errors which occur while handling "
|
|
|
|
|
"logging events - such as logging misconfiguration, network or other similar "
|
|
|
|
|
"errors - do not cause the application using logging to terminate prematurely."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1008
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`SystemExit` and :class:`KeyboardInterrupt` exceptions are never "
|
|
|
|
|
"swallowed. Other exceptions which occur during the :meth:`~Handler.emit` "
|
|
|
|
|
"method of a :class:`Handler` subclass are passed to its :meth:`~Handler."
|
|
|
|
|
"handleError` method."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1013
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The default implementation of :meth:`~Handler.handleError` in :class:"
|
|
|
|
|
"`Handler` checks to see if a module-level variable, :data:`raiseExceptions`, "
|
|
|
|
|
"is set. If set, a traceback is printed to :data:`sys.stderr`. If not set, "
|
|
|
|
|
"the exception is swallowed."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1018
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The default value of :data:`raiseExceptions` is ``True``. This is because "
|
|
|
|
|
"during development, you typically want to be notified of any exceptions that "
|
|
|
|
|
"occur. It's advised that you set :data:`raiseExceptions` to ``False`` for "
|
|
|
|
|
"production usage."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1028
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Using arbitrary objects as messages"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1030
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"In the preceding sections and examples, it has been assumed that the message "
|
|
|
|
|
"passed when logging the event is a string. However, this is not the only "
|
|
|
|
|
"possibility. You can pass an arbitrary object as a message, and its :meth:"
|
|
|
|
|
"`~object.__str__` method will be called when the logging system needs to "
|
|
|
|
|
"convert it to a string representation. In fact, if you want to, you can "
|
|
|
|
|
"avoid computing a string representation altogether - for example, the :class:"
|
|
|
|
|
"`~handlers.SocketHandler` emits an event by pickling it and sending it over "
|
|
|
|
|
"the wire."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1041
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Optimization"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1043
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Formatting of message arguments is deferred until it cannot be avoided. "
|
|
|
|
|
"However, computing the arguments passed to the logging method can also be "
|
|
|
|
|
"expensive, and you may want to avoid doing it if the logger will just throw "
|
|
|
|
|
"away your event. To decide what to do, you can call the :meth:`~Logger."
|
|
|
|
|
"isEnabledFor` method which takes a level argument and returns true if the "
|
|
|
|
|
"event would be created by the Logger for that level of call. You can write "
|
|
|
|
|
"code like this::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1055
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"so that if the logger's threshold is set above ``DEBUG``, the calls to :func:"
|
|
|
|
|
"`expensive_func1` and :func:`expensive_func2` are never made."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1058
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"In some cases, :meth:`~Logger.isEnabledFor` can itself be more expensive "
|
|
|
|
|
"than you'd like (e.g. for deeply nested loggers where an explicit level is "
|
|
|
|
|
"only set high up in the logger hierarchy). In such cases (or if you want to "
|
|
|
|
|
"avoid calling a method in tight loops), you can cache the result of a call "
|
|
|
|
|
"to :meth:`~Logger.isEnabledFor` in a local or instance variable, and use "
|
|
|
|
|
"that instead of calling the method each time. Such a cached value would only "
|
|
|
|
|
"need to be recomputed when the logging configuration changes dynamically "
|
|
|
|
|
"while the application is running (which is not all that common)."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1067
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"There are other optimizations which can be made for specific applications "
|
|
|
|
|
"which need more precise control over what logging information is collected. "
|
|
|
|
|
"Here's a list of things you can do to avoid processing during logging which "
|
|
|
|
|
"you don't need:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1073
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "What you don't want to collect"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1073
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "How to avoid collecting it"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1075
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Information about where calls were made from."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1075
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Set ``logging._srcfile`` to ``None``. This avoids calling :func:`sys."
|
|
|
|
|
"_getframe`, which may help to speed up your code in environments like PyPy "
|
|
|
|
|
"(which can't speed up code that uses :func:`sys._getframe`), if and when "
|
|
|
|
|
"PyPy supports Python 3.x."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1083
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Threading information."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1083
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Set ``logging.logThreads`` to ``0``."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1085
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Process information."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1085
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Set ``logging.logProcesses`` to ``0``."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1088
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Also note that the core logging module only includes the basic handlers. If "
|
|
|
|
|
"you don't import :mod:`logging.handlers` and :mod:`logging.config`, they "
|
|
|
|
|
"won't take up any memory."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1095
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Module :mod:`logging`"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1095
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "API reference for the logging module."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1098
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Module :mod:`logging.config`"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1098
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Configuration API for the logging module."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1101
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Module :mod:`logging.handlers`"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1101
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Useful handlers included with the logging module."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2018-04-28 22:28:01 +00:00
|
|
|
|
#: ../Doc/howto/logging.rst:1103
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ":ref:`A logging cookbook <logging-cookbook>`"
|
|
|
|
|
msgstr ""
|