• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LearnLib / learnlib / 6433387082

06 Oct 2023 03:10PM UTC coverage: 92.296% (-0.007%) from 92.303%
6433387082

push

github

mtf90
update Falk's developer id

11573 of 12539 relevant lines covered (92.3%)

1.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

53.13
/api/src/main/java/de/learnlib/api/logging/LearnLogger.java
1
/* Copyright (C) 2013-2023 TU Dortmund
2
 * This file is part of LearnLib, http://www.learnlib.de/.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package de.learnlib.api.logging;
18

19
import de.learnlib.api.statistic.StatisticData;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
22
import org.slf4j.Marker;
23
import org.slf4j.MarkerFactory;
24

25
/**
26
 * LearnLib specific logger. Adds some methods to Logger for logging artifacts specific to learning.
27
 */
28
public interface LearnLogger extends Logger {
29

30
    /**
31
     * Convenience method for easing the common practice of using a class name as the name for the logger. Calling this
32
     * method is equivalent to
33
     * <pre>
34
     * LearnLogger.getLogger(clazz.getName())
35
     * </pre>
36
     *
37
     * @param clazz
38
     *         the class from which to retrieve the name
39
     *
40
     * @return the logger for the given class name
41
     */
42
    static LearnLogger getLogger(Class<?> clazz) {
43
        return getLogger(clazz.getName());
2✔
44
    }
45

46
    /**
47
     * get an instance of a logger for name. assumes that there is no ordinary logger of the same name.
48
     */
49
    static LearnLogger getLogger(String name) {
50
        return new Slf4jDelegator(LoggerFactory.getLogger(name));
2✔
51
    }
52

53
    /**
54
     * logs a system message at level INFO.
55
     */
56
    default void logSystem(String msg) {
57
        final Marker marker = MarkerFactory.getMarker(Category.SYSTEM.toMarkerLabel());
×
58
        info(marker, msg);
×
59
    }
×
60

61
    /**
62
     * logs a learning phase at level INFO.
63
     */
64
    default void logPhase(String phase) {
65
        final Marker marker = MarkerFactory.getMarker(Category.PHASE.toMarkerLabel());
2✔
66
        info(marker, phase);
2✔
67
    }
2✔
68

69
    /**
70
     * logs a learning query at level INFO.
71
     */
72
    default void logQuery(String phase) {
73
        final Marker marker = MarkerFactory.getMarker(Category.QUERY.toMarkerLabel());
2✔
74
        info(marker, phase);
2✔
75
    }
2✔
76

77
    /**
78
     * logs setup details.
79
     */
80
    default void logConfig(String config) {
81
        final Marker marker = MarkerFactory.getMarker(Category.CONFIG.toMarkerLabel());
×
82
        info(marker, config);
×
83
    }
×
84

85
    /**
86
     * log counterexample.
87
     */
88
    default void logCounterexample(String ce) {
89
        final Marker marker = MarkerFactory.getMarker(Category.COUNTEREXAMPLE.toMarkerLabel());
1✔
90
        info(marker, ce);
1✔
91
    }
1✔
92

93
    /**
94
     * logs an event. E.g., creation of new table row.
95
     */
96
    default void logEvent(String desc) {
97
        final Marker marker = MarkerFactory.getMarker(Category.EVENT.toMarkerLabel());
1✔
98
        info(marker, desc);
1✔
99
    }
1✔
100

101
    /**
102
     * log a piece of profiling info.
103
     */
104
    default void logProfilingInfo(StatisticData profiling) {
105
        final Marker marker = MarkerFactory.getMarker(Category.PROFILING.toMarkerLabel());
×
106
        info(marker, profiling.getSummary());
×
107
    }
×
108

109
    /**
110
     * log statistic info.
111
     */
112
    default void logStatistic(StatisticData statistics) {
113
        final Marker marker = MarkerFactory.getMarker(Category.STATISTIC.toMarkerLabel());
×
114
        info(marker, statistics.getSummary());
×
115
    }
×
116

117
    /**
118
     * log a model.
119
     */
120
    default void logModel(Object o) {
121
        final Marker marker = MarkerFactory.getMarker(Category.MODEL.toMarkerLabel());
1✔
122
        info(marker, o.toString());
1✔
123
    }
1✔
124

125
    /**
126
     * log a data structure.
127
     */
128
    default void logDataStructure(Object o) {
129
        final Marker marker = MarkerFactory.getMarker(Category.DATASTRUCTURE.toMarkerLabel());
×
130
        info(marker, o.toString());
×
131
    }
×
132

133
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc