IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

LoggingCategory QML Type

Defines a logging category in QML.

This type was introduced in Qt 5.8.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

LoggingCategory QML Type

  • Import Statement: import QtQml

  • Since:: Qt 5.8

  • Group: LoggingCategory is part of qml-utility-elements

Detailed Description

A logging category can be passed to console.log() and friends as the first argument. If supplied to to the logger the LoggingCategory's name will be used as Logging Category otherwise the default logging category will be used.

 
Sélectionnez
import QtQuick 2.8

Item {
    LoggingCategory {
        id: category
        name: "com.qt.category"
        defaultLogLevel: LoggingCategory.Warning
    }

    Component.onCompleted: {
      console.log(category, "message");
    }
}

As the creation of objects is expensive, it is encouraged to put the needed LoggingCategory definitions into a singleton and import this where needed.

See Also

See also QLoggingCategory

Property Documentation

 

[since 5.12] defaultLogLevel : enumeration

Holds the default log level of the logging category. By default it is created with the LoggingCategory.Debug log level.

This property needs to be set when declaring the LoggingCategory and cannot be changed later.

This property was introduced in Qt 5.12.

name : string

Holds the name of the logging category.

This property needs to be set when declaring the LoggingCategory and cannot be changed later.

See Also

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+