LoggingCategory QML Type
QML에서 로깅 범주를 정의합니다. 더 보기...
| Import Statement: | import QtQml |
속성
- defaultLogLevel : enumeration
- name : string
자세한 설명
로깅 범주는 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`만 출력합니다. ` defaultLogLevel`로 인해 ` log message `는 출력되지 않습니다. 하지만 ` QLoggingCategory`에 대해 구성하는 것과 동일한 방식으로 QML 로깅 범주의 로깅 레벨을 구성할 수 있습니다.
참고: 객체 생성은 리소스 소모가 크기때문에 , 필요한 LoggingCategory 정의를 싱글톤에 포함시키고 필요한 곳에서 이를 가져오는 것이 권장됩니다.
QLoggingCategory도 참조하십시오 .
속성 문서
defaultLogLevel : enumeration
로깅 범주의 기본 로깅 수준을 지정합니다. 기본적으로 LoggingCategory 의 .Debug 로깅 수준으로 생성됩니다.
다음 열거형 값을 사용할 수 있습니다:
- LoggingCategory.Debug
- LoggingCategory.Info
- LoggingCategory.Warning
- LoggingCategory.Critical
- LoggingCategory.Fatal
이들은 ` QtMsgType ` 열거형의 값을 반영합니다.
참고: 이 속성은 ` LoggingCategory `을 선언할 때 설정해야 하며, 나중에 변경할 수 없습니다.
QtMsgType도 참조하십시오 .
name : string
로깅 범주의 이름을 저장합니다.
참고: 이 속성은 LoggingCategory 를 선언할 때 설정해야 하며, 이후에는 변경할 수 없습니다.
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.