LoggingCategory QML Type
Define una categoría de registro en QML. Más...
| Import Statement: | import QtQml |
Propiedades
- defaultLogLevel : enumeration
- name : string
Descripción detallada
Se puede pasar una categoría de registro a console.log() y friends como primer argumento. Si se proporciona al registrador, el nombre de LoggingCategory se utilizará como categoría de registro. En caso contrario, se utilizará la categoría de registro por defecto.
import QtQuick Item { LoggingCategory { id: category name: "com.qt.category" defaultLogLevel: LoggingCategory.Warning } Component.onCompleted: { console.log(category, "log message"); console.warn(category, "warning message"); } }
Por defecto, esto sólo produce com.qt.category: warning message. El log message se suprime debido al defaultLogLevel. Sin embargo, puede configurar los niveles de registro para las categorías de registro QML de la misma manera que puede configurarlos para QLoggingCategory.
Nota: Como la creación de objetos es costosa, se recomienda poner las definiciones necesarias de LoggingCategory en un singleton e importarlo cuando sea necesario.
Véase también QLoggingCategory.
Documentación de propiedades
defaultLogLevel : enumeration
Contiene el nivel de registro por defecto de la categoría de registro. Por defecto se crea con el nivel de registro LoggingCategory.Debug.
Están disponibles los siguientes valores de enumeración:
- LoggingCategory.Debug
- LoggingCategory.Info
- LoggingCategoryAdvertencia
- LoggingCategory.crítico
- LoggingCategoryFatal
Reflejan los valores de la enumeración QtMsgType.
Nota: Esta propiedad debe establecerse al declarar LoggingCategory y no puede modificarse posteriormente.
Véase también QtMsgType.
name : string
Contiene el nombre de la categoría de registro.
Nota: Esta propiedad debe establecerse al declarar LoggingCategory y no puede modificarse posteriormente.
Véase también QLoggingCategory::categoryName().
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.