LoggingCategory QML Type

QML에서 로깅 카테고리를 정의합니다. 더 보기...

Import Statement: import QtQml

속성

자세한 설명

로깅 카테고리는 console.log() 및 친구에 첫 번째 인수로 전달할 수 있습니다. 로거에 제공된 경우 LoggingCategory의 이름이 로깅 카테고리로 사용됩니다. 그렇지 않으면 기본 로깅 카테고리가 사용됩니다.

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");
    }
}

기본적으로 com.qt.category: warning message 만 출력합니다. log messagedefaultLogLevel 으로 인해 표시되지 않지만 QLoggingCategory 에 대한 로그 수준을 구성하는 것과 동일한 방식으로 QML 로깅 카테고리에 대한 로그 수준을 구성할 수 있습니다.

참고: 객체를 생성하는 데 많은 비용이 들기 때문에 필요한 LoggingCategory 정의를 싱글톤에 넣고 필요한 곳에서 이를 가져오는 것이 좋습니다.

QLoggingCategory도 참조하세요 .

속성 문서

defaultLogLevel : enumeration

로깅 카테고리의 기본 로그 수준을 보유합니다. 기본적으로 LoggingCategory.Debug 로그 수준으로 생성됩니다.

다음 열거 값을 사용할 수 있습니다:

QtMsgType 열거형의 값을 반영합니다.

참고: 이 속성은 LoggingCategory 을 선언할 때 설정해야 하며 나중에 변경할 수 없습니다.

QtMsgType참조하세요 .


name : string

로깅 카테고리의 이름을 보유합니다.

참고: 이 속성은 LoggingCategory 을 선언할 때 설정해야 하며 나중에 변경할 수 없습니다.

QLoggingCategory::categoryName()도 참조하세요 .


© 2025 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.