aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlconsole/data/categorized_logging.qml
blob: dd03c0c773a714cfced06b6ecd9b0780c501c9d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (C) 2016 Pelagicore AG
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick 2.12

Item {
    id: root

    LoggingCategory {
        id: testCategory
        name: "qt.test"
    }

    LoggingCategory {
        id: testCategoryStartingFromWarning
        name: "qt.test.warning"
        defaultLogLevel: LoggingCategory.Warning
    }

    LoggingCategory {
        id: emptyCategory
    }

    Component.onCompleted: {
        console.debug(testCategory, "console.debug");
        console.log(testCategory, "console.log");
        console.info(testCategory, "console.info");
        console.warn(testCategory, "console.warn");
        console.error(testCategory, "console.error");
        console.debug(testCategoryStartingFromWarning, "console.debug");
        console.log(testCategoryStartingFromWarning, "console.log");
        console.info(testCategoryStartingFromWarning, "console.info");
        console.warn(testCategoryStartingFromWarning, "console.warn");
        console.error(testCategoryStartingFromWarning, "console.error");

        testCategory.name = "qt.test"; // should be silent
        testCategoryStartingFromWarning.name = "qt.test.other"; // should issue a warning

        testCategory.defaultLogLevel = LoggingCategory.Debug; // should be silent
        testCategoryStartingFromWarning.defaultLogLevel = LoggingCategory.Debug; // should issue a warning

        console.error(emptyCategory, "console.error");
    }
}