# Copyright (C) 2001-2020, Python Software Foundation # This file is distributed under the same license as the Python package. # Maintained by the python-doc-es workteam. # docs-es@python.org / # https://mail.python.org/mailman3/lists/docs-es.python.org/ # Check https://github.com/python/python-docs-es/blob/3.8/TRANSLATORS to get # the list of volunteers # msgid "" msgstr "" "Project-Id-Version: Python 3.8\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-10-25 19:47+0200\n" "PO-Revision-Date: 2021-11-26 15:09+0100\n" "Last-Translator: Cristián Maureira-Fredes \n" "Language: es_US\n" "Language-Team: python-doc-es\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.10.3\n" #: ../Doc/howto/logging.rst:3 msgid "Logging HOWTO" msgstr "HOWTO Hacer Registros (*Logging*)" #: ../Doc/howto/logging.rst msgid "Author" msgstr "Autor" #: ../Doc/howto/logging.rst:5 msgid "Vinay Sajip " msgstr "Vinay Sajip " #: ../Doc/howto/logging.rst:12 msgid "Basic Logging Tutorial" msgstr "Tutorial Básico de *Logging*" #: ../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 "" "*Logging* es un medio de rastrear los eventos que ocurren cuando se ejecuta " "algún software. El desarrollador del software agrega llamadas de registro a " "su código para indicar que ciertos eventos han ocurrido. Un evento se " "describe mediante un mensaje descriptivo que puede contener opcionalmente " "datos variables (es decir, datos que son potencialmente diferentes para cada " "ocurrencia del evento). Los eventos también tienen una importancia que el " "desarrollador atribuye al evento; la importancia también puede llamarse el " "*nivel* o la *severidad*." #: ../Doc/howto/logging.rst:23 msgid "When to use logging" msgstr "Cuándo usar *logging*" #: ../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 "" "*Logging* proporciona un conjunto de funciones convenientes para un uso " "sencillo de registro. Estas son :func:`debug`, :func:`info`, :func:" "`warning`, :func:`error` y :func:`critical`. Para determinar cuándo usar el " "registro, vea la tabla de abajo, que indica, para cada una de las tareas " "comunes, la mejor herramienta a usar para ello." #: ../Doc/howto/logging.rst:31 msgid "Task you want to perform" msgstr "La tarea que quieres realizar" #: ../Doc/howto/logging.rst:31 msgid "The best tool for the task" msgstr "La mejor herramienta para la tarea" #: ../Doc/howto/logging.rst:33 msgid "" "Display console output for ordinary usage of a command line script or program" msgstr "" "Mostrar salidas de la consola para el uso ordinario de un programa o guión " "(script) de línea de comandos" #: ../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 "" "Reportar eventos que ocurren durante el funcionamiento normal de un programa " "(por ejemplo, para la supervisión del estado o la investigación de fallos)" #: ../Doc/howto/logging.rst:37 msgid "" ":func:`logging.info` (or :func:`logging.debug` for very detailed output for " "diagnostic purposes)" msgstr "" ":func:`logging.info` (o :func:`logging.debug` para salidas de registro muy " "detalladas con fines de diagnóstico)" #: ../Doc/howto/logging.rst:42 msgid "Issue a warning regarding a particular runtime event" msgstr "" "Emitir una advertencia con respecto a un evento de tiempo de ejecución en " "particular" #: ../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 "" ":func:`warnings.warn` en el código de la biblioteca si el problema es " "evitable y la aplicación cliente debe ser modificada para eliminar la " "advertencia" #: ../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 "" ":func:`logging.warning` si no hay nada que la aplicación cliente pueda hacer " "sobre la situación, pero el evento debe ser anotado" #: ../Doc/howto/logging.rst:52 msgid "Report an error regarding a particular runtime event" msgstr "" "Reportar un error con respecto a un evento particular al tiempo de ejecución" #: ../Doc/howto/logging.rst:52 msgid "Raise an exception" msgstr "Lanza una excepción" #: ../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 "" "Reporta la supresión de un error sin invocar una excepción (por ejemplo, el " "manejador de errores en un proceso de servidor de larga duración)" #: ../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 "" ":func:`logging.error`, :func:`logging.exception` o :func:`logging.critical` " "según sea apropiado para el error específico y el dominio de la aplicación" #: ../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 "" "Las funciones de registro se denominan según el nivel o la gravedad de los " "eventos que se utilizan para rastrear. A continuación se describen los " "niveles estándar y su aplicabilidad (en orden creciente de gravedad):" #: ../Doc/howto/logging.rst:69 ../Doc/howto/logging.rst:862 msgid "Level" msgstr "Nivel" #: ../Doc/howto/logging.rst:69 msgid "When it's used" msgstr "Cuando es usado" #: ../Doc/howto/logging.rst:71 ../Doc/howto/logging.rst:872 msgid "``DEBUG``" msgstr "``DEBUG``" #: ../Doc/howto/logging.rst:71 msgid "" "Detailed information, typically of interest only when diagnosing problems." msgstr "" "Información detallada, típicamente de interés sólo durante el diagnóstico de " "problemas." #: ../Doc/howto/logging.rst:74 ../Doc/howto/logging.rst:870 msgid "``INFO``" msgstr "``INFO``" #: ../Doc/howto/logging.rst:74 msgid "Confirmation that things are working as expected." msgstr "Confirmación de que las cosas están funcionando como se esperaba." #: ../Doc/howto/logging.rst:77 ../Doc/howto/logging.rst:868 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 "" "Un indicio de que algo inesperado sucedió, o indicativo de algún problema en " "el futuro cercano (por ejemplo, \"espacio de disco bajo\"). El software " "sigue funcionando como se esperaba." #: ../Doc/howto/logging.rst:82 ../Doc/howto/logging.rst:866 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 "" "Debido a un problema más grave, el software no ha sido capaz de realizar " "alguna función." #: ../Doc/howto/logging.rst:85 ../Doc/howto/logging.rst:864 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 "" "Un grave error, que indica que el programa en sí mismo puede ser incapaz de " "seguir funcionando." #: ../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 "" "El nivel por defecto es ``WARNING``, lo que significa que sólo los eventos " "de este nivel y superiores serán rastreados, a menos que el paquete de " "registro esté configurado para hacer lo contrario." #: ../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 "" "Los eventos que se rastrean pueden ser manejados en diferentes maneras. La " "forma más simple de manejar los eventos rastreados es imprimirlos en la " "consola o terminal. Otra forma común es escribirlos en un archivo de disco." #: ../Doc/howto/logging.rst:101 msgid "A simple example" msgstr "Un simple ejemplo" #: ../Doc/howto/logging.rst:103 msgid "A very simple example is::" msgstr "Un ejemplo muy simple es::" #: ../Doc/howto/logging.rst:109 msgid "If you type these lines into a script and run it, you'll see:" msgstr "Si escribes estas líneas en un script y lo ejecutas, verás:" #: ../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 "" "impreso en la consola. El mensaje ``INFO`` no aparece porque el nivel por " "defecto es ``WARNING``. El mensaje impreso incluye la indicación del nivel y " "la descripción del evento proporcionado en la llamada de registro, es decir, " "\"¡Cuidado!\". No te preocupes por la parte de la ‘root’ por ahora: se " "explicará más adelante. La salida real puede ser formateada con bastante " "flexibilidad si lo necesita; las opciones de formato también se explicarán " "más adelante." #: ../Doc/howto/logging.rst:124 msgid "Logging to a file" msgstr "Logging a un archivo" #: ../Doc/howto/logging.rst:126 #, fuzzy 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 "" "Una situación muy común es la de registrar archivos de log, así que veamos " "eso a continuación. Asegúrese de intentar lo siguiente en un intérprete de " "Python recién iniciado, y no sólo continúe de la sesión descrita " "anteriormente::" #: ../Doc/howto/logging.rst:137 msgid "" "The *encoding* argument was added. In earlier Python versions, or if not " "specified, the encoding used is the default value used by :func:`open`. " "While not shown in the above example, an *errors* argument can also now be " "passed, which determines how encoding errors are handled. For available " "values and the default, see the documentation for :func:`open`." msgstr "" "Se agregó el argumento *encoding*. En versiones anteriores de Python, o si " "no se especifica, la codificación utilizada es el valor predeterminado " "utilizado por :func:`open`. Aunque no se muestra en el ejemplo anterior, " "ahora también se puede pasar un argumento *errors*, que determina cómo se " "manejan los errores de codificación. Para conocer los valores disponibles y " "los predeterminados, consulte la documentación de :func:`open`." #: ../Doc/howto/logging.rst:144 msgid "" "And now if we open the file and look at what we have, we should find the log " "messages:" msgstr "" "Y ahora si abrimos el archivo y miramos lo que tenemos, deberíamos encontrar " "los mensajes de registro:" #: ../Doc/howto/logging.rst:154 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 "" "Este ejemplo también muestra cómo se puede establecer el nivel de registro " "que actúa como umbral para el rastreo. En este caso, como establecimos el " "umbral en ``DEBUG``, todos los mensajes fueron impresos." #: ../Doc/howto/logging.rst:158 msgid "" "If you want to set the logging level from a command-line option such as:" msgstr "" "Si quieres establecer el nivel de registro desde una opción de línea de " "comandos como:" #: ../Doc/howto/logging.rst:164 msgid "" "and you have the value of the parameter passed for ``--log`` in some " "variable *loglevel*, you can use::" msgstr "" "y tienes el valor del parámetro pasado por ``--log`` en alguna variable " "*loglevel*, puedes usar::" #: ../Doc/howto/logging.rst:169 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 "" "para obtener el valor que pasarás a :func:`basicConfig` mediante el " "argumento *level*. Puede que quieras comprobar un error por cualquier valor " "de entrada del usuario, quizás como en el siguiente ejemplo::" #: ../Doc/howto/logging.rst:181 #, fuzzy msgid "" "The call to :func:`basicConfig` should come *before* any calls to :func:" "`debug`, :func:`info`, etc. Otherwise, those functions will call :func:" "`basicConfig` for you with the default options. 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 "" "La llamada a :func:`basicConfig` debería venir *antes* de cualquier llamada " "a :func:`debug`, :func:`info` etc. Como se pretende hacer una simple " "facilidad de configuración única, sólo la primera llamada hará realmente " "algo: las llamadas subsiguientes son efectivamente no-ops." #: ../Doc/howto/logging.rst:187 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 "" "Si ejecutas el script anterior varias veces, los mensajes de las ejecuciones " "sucesivas se añaden al archivo *example.log*. Si quieres que cada ejecución " "se inicie de nuevo, sin recordar los mensajes de ejecuciones anteriores, " "puedes especificar el argumento *filemode*, cambiando la llamada en el " "ejemplo anterior a::" #: ../Doc/howto/logging.rst:194 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 "" "La impresión será la misma que antes, pero el archivo de registro ya no se " "adjunta, por lo que los mensajes de las ejecuciones anteriores se pierden." #: ../Doc/howto/logging.rst:199 msgid "Logging from multiple modules" msgstr "*Logging* de múltiples módulos" #: ../Doc/howto/logging.rst:201 msgid "" "If your program consists of multiple modules, here's an example of how you " "could organize logging in it::" msgstr "" "Si su programa consiste de múltiples módulos, aquí hay un ejemplo de cómo " "podría organizar el inicio de sesión en él::" #: ../Doc/howto/logging.rst:225 msgid "If you run *myapp.py*, you should see this in *myapp.log*:" msgstr "Si ejecutas *myapp.py*, deberías ver esto en *myapp.log*:" #: ../Doc/howto/logging.rst:233 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 "" "que es lo que esperabas ver. Puedes generalizar esto a múltiples módulos, " "usando el modelo en *mylib.py*. Ten en cuenta que para este simple patrón de " "uso, no sabrás, mirando en el archivo de registro, *donde* en tu aplicación " "vinieron tus mensajes, aparte de mirar la descripción del evento. Si quieres " "rastrear la ubicación de tus mensajes, tendrás que consultar la " "documentación más allá del nivel del tutorial -- ver :ref:`logging-advanced-" "tutorial`." #: ../Doc/howto/logging.rst:243 msgid "Logging variable data" msgstr "Registrar datos de variables" #: ../Doc/howto/logging.rst:245 msgid "" "To log variable data, use a format string for the event description message " "and append the variable data as arguments. For example::" msgstr "" "Para registrar los datos de variables, utilice una cadena de formato para el " "mensaje de descripción del evento y añada los datos variables como " "argumentos. Por ejemplo::" #: ../Doc/howto/logging.rst:251 msgid "will display:" msgstr "se mostrará:" #: ../Doc/howto/logging.rst:257 #, python-format 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 "" "Como puede ver, la fusión de datos variables en el mensaje de descripción " "del evento utiliza el antiguo estilo % de formato de cadena de caracteres. " "Esto es por compatibilidad con versiones anteriores: el paquete de registro " "es anterior a opciones de formato más nuevas como :meth:`str.format` y :" "class:`string.Template`. Estas nuevas opciones de formato *son* compatibles, " "pero explorarlas está fuera del alcance de este tutorial: consulte :ref:" "`formatting-styles` para obtener más información." #: ../Doc/howto/logging.rst:266 msgid "Changing the format of displayed messages" msgstr "Cambiar el formato de los mensajes mostrados" #: ../Doc/howto/logging.rst:268 msgid "" "To change the format which is used to display messages, you need to specify " "the format you want to use::" msgstr "" "Para cambiar el formato que se utiliza para visualizar los mensajes, es " "necesario especificar el formato que se desea utilizar::" #: ../Doc/howto/logging.rst:277 msgid "which would print:" msgstr "que se imprimirá:" #: ../Doc/howto/logging.rst:285 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 "" "Noten que la ‘root’ que aparecía en los ejemplos anteriores ha desaparecido. " "Para un conjunto completo de cosas que pueden aparecer en formato de " "cadenas, puede consultar la documentación de :ref:`logrecord-attributes`, " "pero para un uso sencillo, sólo necesita el *levelname* (gravedad), " "*message* (descripción del evento, incluyendo los datos variables) y tal vez " "mostrar cuándo ocurrió el evento. Esto se describe en la siguiente sección." #: ../Doc/howto/logging.rst:294 msgid "Displaying the date/time in messages" msgstr "Visualización de la fecha/hora en los mensajes" #: ../Doc/howto/logging.rst:296 #, python-format msgid "" "To display the date and time of an event, you would place '%(asctime)s' in " "your format string::" msgstr "" "Para mostrar la fecha y la hora de un evento, usted colocaría '%(asctime)s' " "en su cadena de formato::" #: ../Doc/howto/logging.rst:303 msgid "which should print something like this:" msgstr "que debería imprimir algo como esto:" #: ../Doc/howto/logging.rst:309 msgid "" "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, " "provide a *datefmt* argument to ``basicConfig``, as in this example::" msgstr "" "El formato por defecto para la visualización de la fecha/hora (mostrado " "arriba) es como ISO8601 o :rfc:`3339`. Si necesita más control sobre el " "formato de la fecha/hora, proporcione un argumento *datefmt* a " "``basicConfig``, como en este ejemplo::" #: ../Doc/howto/logging.rst:317 msgid "which would display something like this:" msgstr "que mostraría algo como esto:" #: ../Doc/howto/logging.rst:323 msgid "" "The format of the *datefmt* argument is the same as supported by :func:`time." "strftime`." msgstr "" "El formato del argumento *datefmt* es el mismo que el soportado por :func:" "`time.strftime`." #: ../Doc/howto/logging.rst:328 msgid "Next Steps" msgstr "Próximos pasos" #: ../Doc/howto/logging.rst:330 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 "" "Eso concluye el tutorial básico. Debería ser suficiente para ponerte en " "marcha con el registro. Hay mucho más que el paquete de registro ofrece, " "pero para obtener lo mejor de él, tendrá que invertir un poco más de su " "tiempo en la lectura de las siguientes secciones. Si estás listo para eso, " "toma un poco de tu bebida favorita y sigue adelante." #: ../Doc/howto/logging.rst:336 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 " "group (available at https://groups.google.com/forum/#!forum/comp.lang." "python) and you should receive help before too long." msgstr "" "Si sus necesidades de registro son sencillas, utilice los ejemplos previos " "para incorporar el registro en sus propios scripts, y si tiene problemas o " "no entiende algo, por favor publique una pregunta en el grupo Usenet de comp." "lang.python (disponible en https://groups.google.com/forum/#!forum/comp.lang." "python) y debería recibir ayuda antes de que transcurra demasiado tiempo." #: ../Doc/howto/logging.rst:342 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 "" "¿Todavía esta aquí? Puedes seguir leyendo las siguientes secciones, que " "proporcionan un tutorial un poco más avanzado y profundo que el básico de " "arriba. Después de eso, puedes echar un vistazo al :ref:`logging-cookbook`." #: ../Doc/howto/logging.rst:350 msgid "Advanced Logging Tutorial" msgstr "Tutorial de registro avanzado" #: ../Doc/howto/logging.rst:352 msgid "" "The logging library takes a modular approach and offers several categories " "of components: loggers, handlers, filters, and formatters." msgstr "" "La biblioteca de logging adopta un enfoque modular y ofrece varias " "categorías de componentes: registradores, gestores, filtros y formateadores." #: ../Doc/howto/logging.rst:355 msgid "Loggers expose the interface that application code directly uses." msgstr "" "Los registradores exponen la interfaz que el código de la aplicación utiliza " "directamente." #: ../Doc/howto/logging.rst:356 msgid "" "Handlers send the log records (created by loggers) to the appropriate " "destination." msgstr "" "Los gestores envían los registros de log (creados por los registradores) al " "destino apropiado." #: ../Doc/howto/logging.rst:358 msgid "" "Filters provide a finer grained facility for determining which log records " "to output." msgstr "" "Los filtros proporcionan una instalación de grano más fino para determinar " "qué registros de log se deben producir." #: ../Doc/howto/logging.rst:360 msgid "Formatters specify the layout of log records in the final output." msgstr "" "Los formatos especifican la disposición de los archivos de log en el " "resultado final." #: ../Doc/howto/logging.rst:362 msgid "" "Log event information is passed between loggers, handlers, filters and " "formatters in a :class:`LogRecord` instance." msgstr "" "La información de los eventos de registro se pasa entre los registradores, " "gestores, filtros y formateadores en una instancia :class:`LogRecord`." #: ../Doc/howto/logging.rst:365 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 "" "El registro se realiza llamando a métodos en instancias de la clase :class:" "`Logger` (de aquí en adelante llamada :dfn:`loggers`). Cada instancia tiene " "un nombre, y se organizan conceptualmente en una jerarquía de espacios de " "nombres utilizando puntos (puntos) como separadores. Por ejemplo, un " "registrador llamado 'scan' es el padre de los registradores 'scan.text', " "'scan.html' y 'scan.pdf'. Los nombres de los registradores pueden ser " "cualquier cosa que se desee, e indican el área de una aplicación en la que " "se origina un mensaje registrado." #: ../Doc/howto/logging.rst:372 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 "" "Una buena convención que se puede utilizar para nombrar a los registradores " "es utilizar un registrador a nivel de módulo, en cada módulo que utilice el " "registro, llamado de la siguiente manera::" #: ../Doc/howto/logging.rst:377 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 "" "Esto significa que los nombres de los registradores rastrean la jerarquía de " "paquetes/módulos, y es intuitivamente obvio donde se registran los eventos " "sólo a partir del nombre del registrador." #: ../Doc/howto/logging.rst:380 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 "" "La raíz de la jerarquía de los registradores se llama root *logger*. Ese es " "el registrador usado por las funciones :func:`debug`, :func:`info`, :func:" "`warning`, :func:`error` y :func:`critícal`, que sólo llaman al mismo método " "del registrador raíz. Las funciones y los métodos tienen las mismas firmas. " "El nombre del root *logger* se imprime como ‘root’ en la salida registrada." #: ../Doc/howto/logging.rst:386 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 "" "Por supuesto, es posible registrar mensajes a diferentes destinos. El " "paquete incluye soporte para escribir mensajes de registro en archivos, " "ubicaciones HTTP GET/POST, correo electrónico a través de SMTP, sockets " "genéricos, colas o mecanismos de registro específicos del sistema operativo " "como syslog o el registro de eventos de Windows NT. Los destinos son " "servidos por clases :dfn:`handler`. Puedes crear tu propia clase de destino " "de registro si tienes requisitos especiales que no se cumplen con ninguna de " "las clases de gestor incorporadas." #: ../Doc/howto/logging.rst:393 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 "" "Por defecto, no se establece ningún destino para los mensajes de registro. " "Puede especificar un destino (como consola o archivo) usando :func:" "`basicConfig` como en los ejemplos del tutorial. Si llama a las funciones :" "func:`debug`, :func:`info`, :func:`warning`, :func:`error` y :func:" "`critical`, ellas comprobarán si no hay ningún destino establecido; y si no " "hay ninguno establecido, establecerán un destino de la consola (``sys." "stderr``) y un formato por defecto para el mensaje mostrado antes de delegar " "en el registrador root para hacer la salida real del mensaje." #: ../Doc/howto/logging.rst:401 msgid "The default format set by :func:`basicConfig` for messages is:" msgstr "" "El formato por defecto establecido por :func:`basicConfig` para los mensajes " "es:" #: ../Doc/howto/logging.rst:407 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 "" "Puedes cambiar esto pasando una cadena de formato a :func:`basicConfig` con " "el argumento de la palabra clave *format*. Para todas las opciones relativas " "a cómo se construye una cadena de formato, ver :ref:`formatter-objects`." #: ../Doc/howto/logging.rst:412 msgid "Logging Flow" msgstr "Flujo de Registro" #: ../Doc/howto/logging.rst:414 msgid "" "The flow of log event information in loggers and handlers is illustrated in " "the following diagram." msgstr "" "En el siguiente diagrama se ilustra el flujo de información de los eventos " "de registro en los registradores y gestores." #: ../Doc/howto/logging.rst:420 msgid "Loggers" msgstr "Registradores" #: ../Doc/howto/logging.rst:422 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 "" "Los objetos de :class:`Logger` tienen un trabajo triple. Primero, exponen " "varios métodos al código de la aplicación para que las aplicaciones puedan " "registrar mensajes en tiempo de ejecución. Segundo, los objetos *logger* " "determinan sobre qué mensajes de registro actuar en base de la severidad (la " "facilidad de filtrado por defecto) o los objetos de filtro. Tercero, los " "objetos registradores pasan los mensajes de registro relevantes a todos los " "manejadores de registro interesados." #: ../Doc/howto/logging.rst:428 msgid "" "The most widely used methods on logger objects fall into two categories: " "configuration and message sending." msgstr "" "Los métodos más utilizados en los objetos de registro se dividen en dos " "categorías: configuración y envío de mensajes." #: ../Doc/howto/logging.rst:431 msgid "These are the most common configuration methods:" msgstr "Estos son los métodos de configuración más comunes:" #: ../Doc/howto/logging.rst:433 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 "" ":meth:`Logger.setLevel` especifica el mensaje de registro de menor gravedad " "que un registrador manejará, donde debug es el nivel de gravedad incorporado " "más bajo y *critical* es el de mayor gravedad incorporado. Por ejemplo, si " "el nivel de severidad es INFO, el registrador sólo manejará los mensajes " "INFO, WARNING, ERROR y CRITICAL e ignorará los mensajes DEBUG." #: ../Doc/howto/logging.rst:439 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 "" ":meth:`Logger.addHandler` y :meth:`Logger.removeHandler` agregan y quitan " "los objetos *handler* del objeto *logger*. Los manejadores (*handlers*) se " "tratan con más detalle en :ref:`handler-basic`." #: ../Doc/howto/logging.rst:443 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 "" ":meth:`Logger.addFilter` y :meth:`Logger.removeFilter` agregan y quitan los " "objetos de filtro del objeto logger. Los filtros se tratan con más detalle " "en :ref:`filter`." #: ../Doc/howto/logging.rst:447 msgid "" "You don't need to always call these methods on every logger you create. See " "the last two paragraphs in this section." msgstr "" "No es necesario que siempre llames a estos métodos en cada registrador que " "crees. Vea los dos últimos párrafos de esta sección." #: ../Doc/howto/logging.rst:450 msgid "" "With the logger object configured, the following methods create log messages:" msgstr "" "Con el objeto *logger* configurado, los siguientes métodos crean mensajes de " "log:" #: ../Doc/howto/logging.rst:452 #, python-format 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 "" ":meth:`Logger.debug`, :meth:`Logger.info`, :meth:`Logger.warning`, :meth:" "`Logger.error`, y :meth:`Logger.critical` todos crean registros de registro " "con un mensaje y un nivel que corresponde a sus respectivos nombres de " "método. El mensaje es en realidad una cadena de formato, que puede contener " "la sintaxis estándar de sustitución de cadenas de ``%s``, ``%d``, ``%f``, y " "así sucesivamente. El resto de sus argumentos es una lista de objetos que " "se corresponden con los campos de sustitución del mensaje. Con respecto a " "``**kwargs``, los métodos de registro sólo se preocupan por una palabra " "clave de ``exc_info`` y la usan para determinar si registran información de " "excepción." #: ../Doc/howto/logging.rst:462 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 "" ":meth:`Logger.exception` crea un mensaje de registro similar a :meth:`Logger." "error`. La diferencia es que :meth:`Logger.exception` vuelca un rastro de " "pila junto con él. Llama a este método sólo desde un manejador de " "excepciones." #: ../Doc/howto/logging.rst:466 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 "" ":meth:`Logger.log` toma un nivel de log como argumento explícito. Esto es " "un poco más verboso para el registro de mensajes que usar los métodos de " "conveniencia de nivel de registro listados arriba, pero así es como se " "registra en niveles de registro personalizados." #: ../Doc/howto/logging.rst:470 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 "" ":func:`getLogger` retorna una referencia a una instancia de *logger* con el " "nombre especificado si se proporciona, o ``root`` si no. Los nombres son " "estructuras jerárquicas separadas por períodos. Múltiples llamadas a :func:" "`getLogger` con el mismo nombre retornarán una referencia al mismo objeto " "*logger*. Los *loggers* que están más abajo en la lista jerárquica son " "hijos de los *loggers* que están más arriba en la lista. Por ejemplo, dado " "un *logger* con un nombre de ``foo``, los *loggers* con nombres de ``foo." "bar``, ``foo.bar.baz``, y ``foo.bam`` son todos descendientes de ``foo``." #: ../Doc/howto/logging.rst:478 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 "" "Los registradores tienen un concepto de *nivel efectivo*. Si un nivel no se " "establece explícitamente en un registrador, el nivel de su clase padre se " "utiliza en su lugar como su nivel efectivo. Si el padre no tiene un nivel " "explícito establecido, *su* padre es examinado, y así sucesivamente - se " "buscan todos los ancestros hasta que se encuentra un nivel explícitamente " "establecido. El registrador raíz siempre tiene un conjunto de niveles " "explícito (``Advertencia`` por defecto). Cuando se decide si se procesa un " "evento, el nivel efectivo del registrador se utiliza para determinar si el " "evento se pasa a los manejadores del registrador." #: ../Doc/howto/logging.rst:486 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 "" "Los *loggers* inferiores propagan mensajes hasta los gestores asociados con " "sus *loggers* ancestros. Debido a esto, no es necesario definir y configurar " "los manejadores para todos los registradores que utiliza una aplicación. " "Basta con configurar los manejadores para un registrador de nivel superior y " "crear registradores hijos según sea necesario. (Sin embargo, puedes " "desactivar la propagación estableciendo el atributo *propagate* de un " "*logger* en ``False``.)" #: ../Doc/howto/logging.rst:497 msgid "Handlers" msgstr "Gestores" #: ../Doc/howto/logging.rst:499 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 "" "Los objetos :class:`~logging.Handler` son responsables de enviar los " "mensajes de registro apropiados (basados en la severidad de los mensajes de " "registro) al destino especificado por el handler. :class:`Logger` los " "objetos pueden añadir cero o más objetos *handler* a sí mismos con un " "método :meth:`~Logger.addHandler`. Como escenario de ejemplo, una " "aplicación puede querer enviar todos los mensajes de registro a un archivo " "de registro, todos los mensajes de registro de error o superiores a stdout, " "y todos los mensajes de crítico a una dirección de correo electrónico. Este " "escenario requiere tres manejadores individuales donde cada manejador es " "responsable de enviar mensajes de una severidad específica a una ubicación " "específica." #: ../Doc/howto/logging.rst:509 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 "" "La biblioteca estándar incluye bastantes tipos de *handler* (ver :ref:" "`useful-handlers`); los tutoriales usan principalmente :class:" "`StreamHandler` y :class:`FileHandler` en sus ejemplos." #: ../Doc/howto/logging.rst:513 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 "" "Hay muy pocos métodos en un manejador para que los desarrolladores de " "aplicaciones se preocupen. Los únicos métodos de manejador que parecen " "relevantes para los desarrolladores de aplicaciones que utilizan los objetos " "de manejador incorporados (es decir, que no crean manejadores " "personalizados) son los siguientes métodos de configuración:" #: ../Doc/howto/logging.rst:518 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 "" "El método :meth:`~Handler.setLevel`, al igual que en los objetos de " "*logger*, especifica la menor gravedad que será enviada al destino " "apropiado. ¿Por qué hay dos métodos :func:`setLevel`? El nivel establecido " "en el registrador determina qué gravedad de los mensajes pasará a sus " "manejadores. El nivel establecido en cada manejador determina qué mensajes " "enviará ese manejador." #: ../Doc/howto/logging.rst:524 msgid "" ":meth:`~Handler.setFormatter` selects a Formatter object for this handler to " "use." msgstr "" ":meth:`~Handler.setFormatter` selecciona un objeto *Formatter* para que este " "*handler* lo use." #: ../Doc/howto/logging.rst:527 msgid "" ":meth:`~Handler.addFilter` and :meth:`~Handler.removeFilter` respectively " "configure and deconfigure filter objects on handlers." msgstr "" ":meth:`~Handler.addFilter` y :meth:`~Handler.removeFilter` respectivamente " "configuran y desconfiguran los objetos del filtro en los handlers." #: ../Doc/howto/logging.rst:530 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 "" "El código de la aplicación no debe instanciar directamente y usar instancias " "de :class:`Handler`. En su lugar, la clase :class:`Handler` es una clase " "base que define la interfaz que todos los *handlers* deben tener y establece " "algún comportamiento por defecto que las clases hijas pueden usar (o anular)." #: ../Doc/howto/logging.rst:537 msgid "Formatters" msgstr "Formateadores" #: ../Doc/howto/logging.rst:539 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 "" "Los objetos de formato configuran el orden final, la estructura y el " "contenido del mensaje de registro. A diferencia de la clase base :class:" "`logging.Handler`, el código de la aplicación puede instanciar clases de " "formateo, aunque probablemente podría subclasificar el formateo si su " "aplicación necesita un comportamiento especial. El constructor toma tres " "argumentos opcionales -- una cadena de formato de mensaje, una cadena de " "formato de fecha y un indicador de estilo." #: ../Doc/howto/logging.rst:548 msgid "" "If there is no message format string, the default is to use the raw " "message. If there is no date format string, the default date format is:" msgstr "" "Si no hay una cadena de formato de mensaje, el valor predeterminado es " "utilizar el mensaje en bruto. Si no hay una cadena de formato de fecha, el " "formato de fecha por defecto es:" #: ../Doc/howto/logging.rst:555 #, fuzzy 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 "" "con los milisegundos clavados al final. El ``style`` es uno de `%`, ‘{‘ o " "‘$’. Si uno de estos no se especifica, entonces se usará ‘%’." #: ../Doc/howto/logging.rst:558 #, fuzzy msgid "" "If the ``style`` is ``'%'``, the message format string uses ``%()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 "" "Si el ``style`` es '%', la cadena del formato de mensaje utiliza " "``%()s`` estilo de sustitución de cadena; las posibles " "claves están documentadas en :ref:`logrecord-attributes`. Si el estilo es " "'{', se asume que la cadena del formato del mensaje es compatible con :meth:" "`str.format` (usando argumentos de palabras clave), mientras que si el " "estilo es '$' entonces la cadena del formato del mensaje debe ajustarse a lo " "que se espera de :meth:`string.Template.substitute`." #: ../Doc/howto/logging.rst:565 msgid "Added the ``style`` parameter." msgstr "Añadió el parámetro ``style``." #: ../Doc/howto/logging.rst:568 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 "" "La siguiente cadena de formato de mensaje registrará la hora en un formato " "legible para los humanos, la gravedad del mensaje y el contenido del " "mensaje, en ese orden::" #: ../Doc/howto/logging.rst:574 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 "" "Los formateadores utilizan una función configurable por el usuario para " "convertir la hora de creación de un registro en una tupla. Por defecto, se " "utiliza :func:`time.localtime`; para cambiar esto para una instancia de " "formateador particular, establezca el atributo ``converter`` de la instancia " "a una función con la misma firma que :func:`time.localtime` o :func:`time." "gmtime`. Para cambiarlo para todos los formateadores, por ejemplo si quieres " "que todas las horas de registro se muestren en GMT, establece el atributo " "``converter`` en la clase *Formatter* (a ``time.gmtime`` para mostrar GMT)." #: ../Doc/howto/logging.rst:584 msgid "Configuring Logging" msgstr "Configuración del registro" #: ../Doc/howto/logging.rst:588 msgid "Programmers can configure logging in three ways:" msgstr "Los programadores pueden configurar el registro en tres maneras:" #: ../Doc/howto/logging.rst:590 msgid "" "Creating loggers, handlers, and formatters explicitly using Python code that " "calls the configuration methods listed above." msgstr "" "Creando registradores, manejadores y formateadores explícitamente usando " "código Python que llama a los métodos de configuración listados arriba." #: ../Doc/howto/logging.rst:592 msgid "" "Creating a logging config file and reading it using the :func:`fileConfig` " "function." msgstr "" "Creando un archivo de configuración de registro y leyéndolo usando la " "función :func:`fileConfig`." #: ../Doc/howto/logging.rst:594 msgid "" "Creating a dictionary of configuration information and passing it to the :" "func:`dictConfig` function." msgstr "" "Creando un diccionario de información de configuración y pasándolo a la " "función :func:`dictConfig`." #: ../Doc/howto/logging.rst:597 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 "" "Para la documentación de referencia sobre las dos últimas opciones, vea :ref:" "`logging-config-api`. El siguiente ejemplo configura un *logger* muy " "simple, un manejador de consola, y un formateador simple usando código " "Python::" #: ../Doc/howto/logging.rst:627 msgid "" "Running this module from the command line produces the following output:" msgstr "" "Ejecutar este módulo desde la línea de comandos produce la siguiente salida:" #: ../Doc/howto/logging.rst:638 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 "" "El siguiente módulo de Python crea un registrador, manejador y formateador " "casi idéntico a los del ejemplo anterior, con la única diferencia de los " "nombres de los objetos::" #: ../Doc/howto/logging.rst:657 msgid "Here is the logging.conf file:" msgstr "Aquí está el archivo logging.conf:" #: ../Doc/howto/logging.rst:689 msgid "" "The output is nearly identical to that of the non-config-file-based example:" msgstr "" "La salida es casi idéntica a la del ejemplo basado en un archivo no " "configurado:" #: ../Doc/howto/logging.rst:700 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 "" "Se puede ver que el enfoque del archivo de configuración tiene algunas " "ventajas sobre el enfoque del código Python, principalmente la separación de " "la configuración y el código y la capacidad de los no codificadores de " "modificar fácilmente las propiedades de registro." #: ../Doc/howto/logging.rst:704 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 non-root 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 "" "La función :func:`fileConfig`` toma un parámetro por defecto, " "``disable_existing_loggers``, que por defecto es ``True`` por razones de " "compatibilidad retroactiva. Esto puede ser o no lo que usted quiera, ya que " "causará que cualquier registrador no existente antes de la llamada :func:" "`fileConfig` sea desactivado a menos que ellos (o un ancestro) sean " "nombrados explícitamente en la configuración. Por favor, consulte la " "documentación de referencia para más información, y especifique ``False`` " "para este parámetro si lo desea." #: ../Doc/howto/logging.rst:712 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 "" "El diccionario pasado a :func:`dictConfig` también puede especificar un " "valor booleano con la tecla ``disable_existing_loggers``, que si no se " "especifica explícitamente en el diccionario también se interpreta por " "defecto como ``True``. Esto lleva al comportamiento de deshabilitación de " "los registradores descrito anteriormente, que puede no ser lo que usted " "desea - en cuyo caso, proporcione a la clave explícitamente un valor de " "``False``." #: ../Doc/howto/logging.rst:722 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 "" "Obsérvese que los nombres de clase a los que se hace referencia en los " "archivos de configuración deben ser relativos al módulo de registro, o bien " "valores absolutos que puedan resolverse mediante mecanismos de importación " "normales. Por lo tanto, puedes usar :class:`~logging.handlers." "WatchedFileHandler` (relativo al módulo de registro) o ``mypackage.mymodule." "MyHandler`` (para una clase definida en el paquete ``mypackage`` y el módulo " "``mymodule``, donde ``mypackage`` está disponible en la ruta de importación " "de Python)." #: ../Doc/howto/logging.rst:730 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 "" "En Python 3.2, se ha introducido un nuevo medio para configurar el registro, " "utilizando diccionarios para guardar la información de configuración. Esto " "proporciona un superconjunto de la funcionalidad del enfoque basado en " "archivos de configuración descrito anteriormente, y es el método de " "configuración recomendado para nuevas aplicaciones y despliegues. Dado que " "se utiliza un diccionario de Python para guardar información de " "configuración, y dado que se puede rellenar ese diccionario utilizando " "diferentes medios, se dispone de más opciones de configuración. Por ejemplo, " "puede utilizar un archivo de configuración en formato JSON o, si tiene " "acceso a la funcionalidad de procesamiento YAML, un archivo en formato YAML, " "para rellenar el diccionario de configuración. O, por supuesto, puedes " "construir el diccionario en código Python, recibirlo en forma encurtida " "sobre un zócalo, o usar cualquier enfoque que tenga sentido para tu " "aplicación." #: ../Doc/howto/logging.rst:742 msgid "" "Here's an example of the same configuration as above, in YAML format for the " "new dictionary-based approach:" msgstr "" "Aquí hay un ejemplo de la misma configuración que arriba, en formato YAML " "para el nuevo enfoque basado en el diccionario:" #: ../Doc/howto/logging.rst:766 msgid "" "For more information about logging using a dictionary, see :ref:`logging-" "config-api`." msgstr "" "Para más información sobre el registro usando un diccionario, ver :ref:" "`logging-config-api`." #: ../Doc/howto/logging.rst:770 msgid "What happens if no configuration is provided" msgstr "¿Qué pasa si no se proporciona ninguna configuración" #: ../Doc/howto/logging.rst:772 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 "" "Si no se proporciona una configuración de registro, es posible que se " "produzca una situación en la que sea necesario dar salida a un suceso de " "registro, pero no se puede encontrar a ningún gestor para dar salida al " "suceso. El comportamiento del paquete de registro en estas circunstancias " "depende de la versión de Python." #: ../Doc/howto/logging.rst:777 msgid "For versions of Python prior to 3.2, the behaviour is as follows:" msgstr "" "Para las versiones de Python anteriores a la 3.2, el comportamiento es el " "siguiente:" #: ../Doc/howto/logging.rst:779 msgid "" "If *logging.raiseExceptions* is ``False`` (production mode), the event is " "silently dropped." msgstr "" "Si *logging.raiseExceptions* es ``Falso`` (modo de producción), el evento es " "abandonado silenciosamente." #: ../Doc/howto/logging.rst:782 msgid "" "If *logging.raiseExceptions* is ``True`` (development mode), a message 'No " "handlers could be found for logger X.Y.Z' is printed once." msgstr "" "Si *logging.raiseExceptions* es ``True`` (modo de desarrollo), se imprime " "una vez un mensaje '*No handlers could be found for logger X.Y.Z*' ('No se " "pudo encontrar ningún manejador (*handler*) para el *logger* X.Y.Z')." #: ../Doc/howto/logging.rst:785 msgid "In Python 3.2 and later, the behaviour is as follows:" msgstr "En Python 3.2 y posteriores, el comportamiento es el siguiente:" #: ../Doc/howto/logging.rst:787 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 "" "El evento es emitido usando un ‘handler de último recurso’, almacenado en " "``logging.lastResort``. Este manejador interno no está asociado con ningún " "logger, y actúa como un :class:`~logging.StreamHandler`` que escribe el " "mensaje de descripción del evento con el valor actual de ``sys.stderr`` " "(respetando así cualquier redireccionamiento que pueda estar en vigor). No " "se hace ningún tipo de formateo en el mensaje, sólo se imprime el mensaje de " "descripción del evento. El nivel del manejador se establece en ``WARNING``, " "por lo que todos los eventos de esta y mayores severidades serán emitidos." #: ../Doc/howto/logging.rst:796 msgid "" "To obtain the pre-3.2 behaviour, ``logging.lastResort`` can be set to " "``None``." msgstr "" "Para obtener el comportamiento anterior a la 3.2, ``logging.lastResort`` se " "puede configurar como ``None``." #: ../Doc/howto/logging.rst:801 msgid "Configuring Logging for a Library" msgstr "Configurando Logging para una biblioteca" #: ../Doc/howto/logging.rst:803 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 "" "Cuando se desarrolla una biblioteca que utiliza el registro, se debe tener " "cuidado de documentar la forma en que la biblioteca utiliza el registro, por " "ejemplo, los nombres de los registradores utilizados. También hay que tener " "en cuenta su configuración de registro. Si la aplicación que lo utiliza no " "usa el registro, y el código de la biblioteca hace llamadas de registro, " "entonces (como se describe en la sección anterior) los eventos de gravedad " "``WARNING`` y mayores se imprimirán en ``sys.stderr``. Esto se considera el " "mejor comportamiento por defecto." #: ../Doc/howto/logging.rst:811 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 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 "" "Si por alguna razón usted *no* quiere que estos mensajes se impriman en " "ausencia de cualquier configuración de registro, puede adjuntar un manejador " "de no hacer nada al registrador de nivel superior de su biblioteca. Esto " "evita que el mensaje se imprima, ya que siempre se encontrará un manejador " "para los eventos de la biblioteca: simplemente no produce ninguna salida. Si " "el usuario de la biblioteca configura el registro para el uso de la " "aplicación, presumiblemente esa configuración añadirá algunos manejadores, y " "si los niveles están configurados adecuadamente, entonces las llamadas de " "registro realizadas en el código de la biblioteca enviarán una salida a esos " "manejadores, como es normal." #: ../Doc/howto/logging.rst:820 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 "" "Un manejador de no hacer nada está incluido en el paquete de registro: :" "class:`~logging.NullHandler` (desde Python 3.1). Una instancia de este " "manejador podría ser añadida al *logger* de nivel superior del espacio de " "nombres de registro usado por la biblioteca (*si* quieres evitar que los " "eventos de registro de tu biblioteca se envíen a ``sys.stderr`` en ausencia " "de la configuración de registro). Si todo el registro de una biblioteca " "*foo* se hace usando registradores con nombres que coincidan con 'foo.x', " "'foo.x.y', etc. entonces el código::" #: ../Doc/howto/logging.rst:831 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 "" "debería tener el efecto deseado. Si una organización produce varias " "bibliotecas, el nombre del registrador especificado puede ser ‘orgname.foo’ " "en lugar de sólo ‘foo’." #: ../Doc/howto/logging.rst:835 msgid "" "It is strongly advised that you *do not log to the root logger* in your " "library. Instead, use a logger with a unique and easily identifiable name, " "such as the ``__name__`` for your library's top-level package or module. " "Logging to the root logger will make it difficult or impossible for the " "application developer to configure the logging verbosity or handlers of your " "library as they wish." msgstr "" #: ../Doc/howto/logging.rst:842 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 "" "Se recomienda encarecidamente que *no añada ningún otro manejador que no " "sea* :class:`~logging.NullHandler` *a los loggers de su biblioteca*. Esto se " "debe a que la configuración de los *handlers* es prerrogativa del " "desarrollador de aplicaciones que utiliza su biblioteca. El desarrollador de " "la aplicación conoce su público objetivo y qué manejadores son los más " "apropiados para su aplicación: si añades manejadores ‘bajo el capó’, podrías " "interferir en su capacidad de realizar pruebas unitarias y entregar " "registros que se ajusten a sus necesidades." #: ../Doc/howto/logging.rst:853 msgid "Logging Levels" msgstr "Niveles de registro" #: ../Doc/howto/logging.rst:855 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 "" "Los valores numéricos de los niveles de registro se indican en el siguiente " "cuadro. Éstos son de interés principalmente si se desea definir los propios " "niveles y se necesita que tengan valores específicos en relación con los " "niveles predefinidos. Si se define un nivel con el mismo valor numérico, " "éste sobrescribe el valor predefinido; el nombre predefinido se pierde." #: ../Doc/howto/logging.rst:862 msgid "Numeric value" msgstr "Valor numérico" #: ../Doc/howto/logging.rst:864 msgid "50" msgstr "50" #: ../Doc/howto/logging.rst:866 msgid "40" msgstr "40" #: ../Doc/howto/logging.rst:868 msgid "30" msgstr "30" #: ../Doc/howto/logging.rst:870 msgid "20" msgstr "20" #: ../Doc/howto/logging.rst:872 msgid "10" msgstr "10" #: ../Doc/howto/logging.rst:874 msgid "``NOTSET``" msgstr "``NOTSET``" #: ../Doc/howto/logging.rst:874 msgid "0" msgstr "0" #: ../Doc/howto/logging.rst:877 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 "" "Los niveles también pueden asociarse con los registradores, siendo " "establecidos por el desarrollador o mediante la carga de una configuración " "de registro guardada. Cuando se llama a un método de registro en un " "registrador, éste compara su propio nivel con el nivel asociado a la llamada " "del método. Si el nivel del registrador es superior al de la llamada al " "método, no se genera ningún mensaje de registro. Este es el mecanismo básico " "que controla la verbosidad de la salida del registro." #: ../Doc/howto/logging.rst:884 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 "" "Los mensajes de registro se codifican como instancias de la clase :class:" "`logging.LogRecord`. Cuando un *logger* decide registrar realmente un " "evento, se crea una instancia :class:`~logging.LogRecord` a partir del " "mensaje de registro." #: ../Doc/howto/logging.rst:888 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 "" "Los mensajes de registro están sujetos a un mecanismo de envío mediante el " "uso de :dfn:`handlers`, que son instancias de subclases de la clase :class:" "`Handler`. Los gestores son responsables de asegurar que un mensaje " "registrado (en forma de :class:`LogRecord`) termine en una ubicación " "particular (o conjunto de ubicaciones) que sea útil para el público al que " "va dirigido ese mensaje (como usuarios finales, personal de asistencia " "técnica, administradores de sistemas, desarrolladores). Los manejadores " "pasan instancias :class:`LogRecord` destinadas a destinos particulares. Cada " "*logger* puede tener cero, uno o más manejadores asociados a él (a través " "del método :meth:`~Logger.addHandler` de :class:`Logger`). Además de los " "*handlers* directamente asociados a un *logger*, todos los manejadores " "(*handlers*) asociados a todos los ancestros del *logger* son llamados a " "enviar el mensaje (a menos que el flag *propagate* de un *logger* se " "establezca en un valor falso, en cuyo caso el paso a los *handlers* " "ancestrales se detiene)." #: ../Doc/howto/logging.rst:902 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 "" "Al igual que para los *logger*, los gestores pueden tener niveles asociados " "a ellos. El nivel de un gestor actúa como un filtro de la misma manera que " "el nivel de un *logger*. Si un manejador (*handler*) decide realmente enviar " "un evento, el método :meth:`~Handler.emit` se utiliza para enviar el mensaje " "a su destino. La mayoría de las subclases definidas por el usuario de :class:" "`Handler` necesitarán anular este :meth:`~Handler.emit`." #: ../Doc/howto/logging.rst:911 msgid "Custom Levels" msgstr "Niveles personalizados" #: ../Doc/howto/logging.rst:913 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 "" "Definir sus propios niveles es posible, pero no debería ser necesario, ya " "que los niveles existentes se han elegido sobre la base de la experiencia " "práctica. Sin embargo, si usted está convencido de que necesita niveles " "personalizados, debe tener mucho cuidado al hacer esto, y es posiblemente " "*una muy mala idea definir niveles personalizados si está desarrollando una " "biblioteca*. Esto se debe a que si los autores de múltiples bibliotecas " "definen sus propios niveles personalizados, existe la posibilidad de que el " "resultado del registro de tales bibliotecas múltiples utilizadas " "conjuntamente sea difícil de controlar y/o interpretar para el desarrollador " "usuario, porque un valor numérico dado podría significar cosas diferentes " "para diferentes bibliotecas." #: ../Doc/howto/logging.rst:926 msgid "Useful Handlers" msgstr "Gestores útiles" #: ../Doc/howto/logging.rst:928 msgid "" "In addition to the base :class:`Handler` class, many useful subclasses are " "provided:" msgstr "" "Además de la base :class:`Handler` class, se proporcionan muchas subclases " "útiles:" #: ../Doc/howto/logging.rst:931 msgid "" ":class:`StreamHandler` instances send messages to streams (file-like " "objects)." msgstr "" ":class:`StreamHandler` instancias envían mensajes a los *streams* (objetos " "como de tipo archivo)." #: ../Doc/howto/logging.rst:934 msgid ":class:`FileHandler` instances send messages to disk files." msgstr "" ":class:`FileHandler` instancias enviar mensajes a los archivos del disco." #: ../Doc/howto/logging.rst:936 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 "" ":class:`~handlers.BaseRotatingHandler` es la clase base para los manejadores " "(*handlers*) que rotan los archivos de registro en un punto determinado. No " "está pensada para ser instanciada directamente. En su lugar, utilice :class:" "`~handlers.RotatingFileHandler` o :class:`~handlers." "TimedRotatingFileHandler`." #: ../Doc/howto/logging.rst:941 msgid "" ":class:`~handlers.RotatingFileHandler` instances send messages to disk " "files, with support for maximum log file sizes and log file rotation." msgstr "" "Las instancias de :class:`~handlers.RotatingFileHandler` envían mensajes a " "los archivos de disco, con soporte para el tamaño máximo de los archivos de " "registro y la rotación de los mismos." #: ../Doc/howto/logging.rst:944 msgid "" ":class:`~handlers.TimedRotatingFileHandler` instances send messages to disk " "files, rotating the log file at certain timed intervals." msgstr "" "Las instancias de :class:`~handlers.TimedRotatingFileHandler` envían " "mensajes a los archivos de disco, rotando el archivo de registro a ciertos " "intervalos de tiempo." #: ../Doc/howto/logging.rst:947 msgid "" ":class:`~handlers.SocketHandler` instances send messages to TCP/IP sockets. " "Since 3.4, Unix domain sockets are also supported." msgstr "" "Las instancias de :class:`~handlers.SocketHandler` envían mensajes a los " "sockets TCP/IP. Desde la versión 3.4, los sockets de dominio Unix también " "están soportados." #: ../Doc/howto/logging.rst:950 msgid "" ":class:`~handlers.DatagramHandler` instances send messages to UDP sockets. " "Since 3.4, Unix domain sockets are also supported." msgstr "" "Instancias de :class:`~handlers.DatagramHandler` envían mensajes a los " "sockets UDP. Desde la versión 3.4, los sockets de dominio Unix también están " "soportados." #: ../Doc/howto/logging.rst:953 msgid "" ":class:`~handlers.SMTPHandler` instances send messages to a designated email " "address." msgstr "" "Las instancias de :class:`~handlers.SMTPHandler` envían mensajes a una " "dirección de correo electrónico designada." #: ../Doc/howto/logging.rst:956 msgid "" ":class:`~handlers.SysLogHandler` instances send messages to a Unix syslog " "daemon, possibly on a remote machine." msgstr "" "Las instancias de :class:`~handlers.SysLogHandler` envían mensajes a un " "demonio del syslog de Unix, posiblemente en una máquina remota." #: ../Doc/howto/logging.rst:959 msgid "" ":class:`~handlers.NTEventLogHandler` instances send messages to a Windows " "NT/2000/XP event log." msgstr "" "Las instancias de :class:`~handlers.NTEventLogHandler` envían mensajes a un " "registro de eventos de Windows NT/2000/XP." #: ../Doc/howto/logging.rst:962 msgid "" ":class:`~handlers.MemoryHandler` instances send messages to a buffer in " "memory, which is flushed whenever specific criteria are met." msgstr "" "Las instancias de :class:`~handlers.MemoryHandler` envían mensajes a un " "buffer en la memoria, que es limpiado cuando se cumplen ciertos criterios." #: ../Doc/howto/logging.rst:965 msgid "" ":class:`~handlers.HTTPHandler` instances send messages to an HTTP server " "using either ``GET`` or ``POST`` semantics." msgstr "" "Las instancias de :class:`~handlers.HTTPHandler` envían mensajes a un " "servidor HTTP usando la semántica de \"GET\" o \"POST\"." #: ../Doc/howto/logging.rst:968 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 "" "Las instancias de :class:`~handlers.WatchedFileHandler` ven el archivo al " "que están accediendo. Si el archivo cambia, se cierra y se vuelve a abrir " "usando el nombre del archivo. Este manejador sólo es útil en sistemas tipo " "Unix; Windows no soporta el mecanismo subyacente utilizado." #: ../Doc/howto/logging.rst:973 msgid "" ":class:`~handlers.QueueHandler` instances send messages to a queue, such as " "those implemented in the :mod:`queue` or :mod:`multiprocessing` modules." msgstr "" "Las instancias de :class:`~handlers.QueueHandler` envían mensajes a una " "cola, como los implementados en los módulos :mod:`queue` or :mod:" "`multiprocessing`." #: ../Doc/howto/logging.rst:976 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 "" ":class:`NullHandler` instancias no hacen nada con los mensajes de error. Son " "utilizadas por los desarrolladores de bibliotecas que quieren utilizar el " "registro, pero quieren evitar el mensaje \"No se pudo encontrar ningún " "controlador para el registrador XXX\", que puede mostrarse si el usuario de " "la biblioteca no ha configurado el registro. Vea :ref:`library-config` para " "más información." #: ../Doc/howto/logging.rst:982 msgid "The :class:`NullHandler` class." msgstr "La clase :class:`NullHandler`." #: ../Doc/howto/logging.rst:985 msgid "The :class:`~handlers.QueueHandler` class." msgstr "La :class:`~handlers.QueueHandler` (La clase de gestores de Cola)." #: ../Doc/howto/logging.rst:988 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 "" "Las clases :class:`NullHandler`, :class:`StreamHandler` y :class:" "`FileHandler` están definidas en el paquete de registro del núcleo. Los " "otros manejadores se definen en un sub-módulo, :mod:`logging.handlers`. " "(También hay otro submódulo, :mod:`logging.config`, para la funcionalidad de " "configuración)" #: ../Doc/howto/logging.rst:993 #, python-format 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 "" "Los mensajes registrados se formatean para su presentación a través de " "instancias de la clase :class:`Formatter`. Se inicializan con una cadena de " "formato adecuada para su uso con el operador % y un diccionario." #: ../Doc/howto/logging.rst:997 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 "" "Para dar formato a varios mensajes en un lote, se pueden utilizar instancias " "de :class:`~handlers.BufferingFormatter`. Además de la cadena de formato " "(que se aplica a cada mensaje del lote), hay una provisión para cadenas de " "formato de cabecera y de tráiler." #: ../Doc/howto/logging.rst:1002 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 "" "Cuando el filtrado basado en el nivel de *logger* o el nivel de manejador " "(*handler*) no es suficiente, se pueden añadir instancias de :class:`Filter` " "tanto a :class:`Logger` como a :class:`Handler` instancias (a través de su " "método :meth:`~Handler.addFilter`). Antes de decidir procesar un mensaje más " "adelante, tanto los *loggers* como los manejadores (*handlers*) consultan " "todos sus filtros para obtener permiso. Si algún filtro retorna un valor " "falso, el mensaje no se procesa más." #: ../Doc/howto/logging.rst:1009 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 "" "La funcionalidad básica :class:`Filtro` permite filtrar por un nombre de " "registro específico. Si se utiliza esta función, los mensajes enviados al " "registrador nombrado y a sus hijos se permiten a través del filtro, y todos " "los demás se eliminan." #: ../Doc/howto/logging.rst:1017 msgid "Exceptions raised during logging" msgstr "Excepciones lanzadas durante logging" #: ../Doc/howto/logging.rst:1019 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 "" "El paquete de tala está diseñado para tragarse las excepciones que se " "producen durante la tala en la producción. Esto es así para que los errores " "que ocurren durante el manejo de los eventos de registro - como la mala " "configuración del registro, errores de red u otros errores similares - no " "causen que la aplicación que utiliza el registro termine prematuramente." #: ../Doc/howto/logging.rst:1024 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 "" "Las excepciones de :class:`SystemExit` (Salida del sistema) y :class:" "`KeyboardInterrupt` (Interrupción del teclado) nunca se tragan. Otras " "excepciones que ocurren durante el método :meth:`~Handler.emit` de una " "subclase :class:`Handler` se pasan a su método :meth:`~Handler.handleError` ." #: ../Doc/howto/logging.rst:1029 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 "" "La implementación por defecto de :meth:`~Handler.handleError` en :class:" "`Handler` comprueba si una variable de nivel de módulo, :data:" "`raiseExceptions`, está establecida. Si se establece, se imprime una traza " "en :data:`sys.stderr`. Si no se establece, se traga la excepción." #: ../Doc/howto/logging.rst:1034 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 "" "El valor por defecto de :data:`raiseExceptions` (lanzar excepciones) es " "``True``. Esto se debe a que durante el desarrollo, normalmente quieres ser " "notificado de cualquier excepción que ocurra. Se aconseja que establezca :" "data:`raiseExceptions` a ``False`` para el uso en producción." #: ../Doc/howto/logging.rst:1044 msgid "Using arbitrary objects as messages" msgstr "Usando objetos arbitrarios como mensajes" #: ../Doc/howto/logging.rst:1046 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 "" "En las secciones y ejemplos anteriores, se ha supuesto que el mensaje pasado " "al registrar el suceso es una cadena. Sin embargo, esta no es la única " "posibilidad. Se puede pasar un objeto arbitrario como mensaje, y su método :" "meth:`~object.__str__` será llamado cuando el sistema de registro necesite " "convertirlo en una representación de cadena. De hecho, si quieres, puedes " "evitar computar una representación de cadena por completo - por ejemplo, el " "método :class:`~handlers.SocketHandler` emite un evento al *pickling* y " "enviarlo por el cable." #: ../Doc/howto/logging.rst:1057 msgid "Optimization" msgstr "Optimización" #: ../Doc/howto/logging.rst:1059 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 "" "El formato de los argumentos del mensaje se aplaza hasta que no se pueda " "evitar. Sin embargo, el cálculo de los argumentos pasados al método de " "registro también puede ser costoso, y puede que quieras evitar hacerlo si el " "registrador simplemente tirará tu evento. Para decidir qué hacer, puedes " "llamar al método :meth:`~Logger.isEnabledFor` que toma un argumento de nivel " "y retorna true si el evento sería creado por el *Logger* para ese nivel de " "llamada. Puedes escribir código como este::" #: ../Doc/howto/logging.rst:1071 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 "" "de modo que si el umbral del registrador se establece por encima de " "``DEBUG``, las llamadas a :func:`expensive_func1` y :func:`expensive_func2` " "nunca se hacen." #: ../Doc/howto/logging.rst:1074 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 "" "En algunos casos, :meth:`~Logger.isEnabledFor` puede ser en sí mismo más " "caro de lo que te gustaría (por ejemplo, para los *loggers* profundamente " "anidados donde un nivel explícito sólo se establece en lo alto de la " "jerarquía de *loggers*). En estos casos (o si quieres evitar llamar a un " "método en bucles estrechos), puedes guardar en caché el resultado de una " "llamada a :meth:`~Logger.isEnabledFor` en una variable local o de instancia, " "y usarla en lugar de llamar al método cada vez. Tal valor en caché sólo " "necesitaría ser recalculado cuando la configuración de registro cambie " "dinámicamente mientras la aplicación se está ejecutando (lo cual no es tan " "común)." #: ../Doc/howto/logging.rst:1083 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 "" "Hay otras optimizaciones que pueden hacerse para aplicaciones específicas " "que necesitan un control más preciso sobre la información de registro que se " "recoge. Aquí hay una lista de cosas que puede hacer para evitar el " "procesamiento durante el registro que no necesita:" #: ../Doc/howto/logging.rst:1089 msgid "What you don't want to collect" msgstr "Lo que no quieres colectar" #: ../Doc/howto/logging.rst:1089 msgid "How to avoid collecting it" msgstr "Cómo evitar coleccionarlo" #: ../Doc/howto/logging.rst:1091 msgid "Information about where calls were made from." msgstr "Información sobre dónde se hicieron las llamadas." #: ../Doc/howto/logging.rst:1091 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`)." msgstr "" "Establezca ``logging._srcfile`` en ``None``. Esto evita llamar a :func:`sys." "_getframe`, que puede ayudar a acelerar su código en entornos como PyPy (que " "no puede acelerar el código que usa :func:`sys._getframe`)." #: ../Doc/howto/logging.rst:1097 msgid "Threading information." msgstr "Información sobre código con hilos." #: ../Doc/howto/logging.rst:1097 msgid "Set ``logging.logThreads`` to ``False``." msgstr "Establece ``logging.logThreads`` en ``False``." #: ../Doc/howto/logging.rst:1099 msgid "Current process ID (:func:`os.getpid`)" msgstr "ID del proceso actual (:func:`os.getpid`)" #: ../Doc/howto/logging.rst:1099 msgid "Set ``logging.logProcesses`` to ``False``." msgstr "Establece ``logging.logProcesses`` en ``False``." #: ../Doc/howto/logging.rst:1101 msgid "" "Current process name when using ``multiprocessing`` to manage multiple " "processes." msgstr "" "Nombre del proceso actual cuando se usa ``multiprocessing`` para administrar " "múltiples procesos." #: ../Doc/howto/logging.rst:1101 msgid "Set ``logging.logMultiprocessing`` to ``False``." msgstr "Establece ``logging.logMultiprocessing`` en ``False``." #: ../Doc/howto/logging.rst:1105 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 "" "Observe también que el módulo de registro del núcleo sólo incluye los " "gestores básicos. Si no importas :mod:`logging.handlers` y :mod:`logging." "config`, no ocuparán ninguna memoria." #: ../Doc/howto/logging.rst:1112 msgid "Module :mod:`logging`" msgstr "Módulo :mod:`logging`" #: ../Doc/howto/logging.rst:1112 msgid "API reference for the logging module." msgstr "Referencia API para el módulo de registro." #: ../Doc/howto/logging.rst:1115 msgid "Module :mod:`logging.config`" msgstr "Módulo :mod:`logging.config`" #: ../Doc/howto/logging.rst:1115 msgid "Configuration API for the logging module." msgstr "API de configuración para el módulo de registro." #: ../Doc/howto/logging.rst:1118 msgid "Module :mod:`logging.handlers`" msgstr "Módulo :mod:`logging.handlers`" #: ../Doc/howto/logging.rst:1118 msgid "Useful handlers included with the logging module." msgstr "Gestores útiles incluidos en el módulo de registro." #: ../Doc/howto/logging.rst:1120 msgid ":ref:`A logging cookbook `" msgstr ":ref:`Un libro de recetas `"