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

future-architect / uroborosql / #771

12 Sep 2024 03:50PM UTC coverage: 90.374% (-0.8%) from 91.197%
#771

Pull #331

HidekiSugimoto189
Merge branch 'feature/add_new_dialect' of https://github.com/future-architect/uroborosql into feature/add_new_dialect
Pull Request #331: add oracle v12-23 and Mariadb 5,10 dialect

497 of 703 new or added lines in 42 files covered. (70.7%)

9 existing lines in 7 files now uncovered.

8928 of 9879 relevant lines covered (90.37%)

0.9 hits per line

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

88.0
/src/main/java/jp/co/future/uroborosql/log/support/LoggerBase.java
1
/**
2
 * Copyright (c) 2017-present, Future Corporation
3
 *
4
 * This source code is licensed under the MIT license found in the
5
 * LICENSE file in the root directory of this source tree.
6
 */
7
package jp.co.future.uroborosql.log.support;
8

9
import org.slf4j.Logger;
10
import org.slf4j.MDC;
11
import org.slf4j.spi.LoggingEventBuilder;
12
import org.slf4j.spi.NOPLoggingEventBuilder;
13

14
/**
15
 * ログ出力する際の共通親インタフェース
16
 */
17
public interface LoggerBase {
18
        /** すべてのログ出力を抑止するためのMDCキー */
19
        String SUPPRESS_LOG_OUTPUT = "UroboroSQL_SuppressLogOutput";
20

21
        /** パラメータログ出力を抑止するためのMDCキー */
22
        String SUPPRESS_PARAMETER_LOG_OUTPUT = "UroboroSQL_SuppressParameterLogOutput";
23

24
        /**
25
         * Uroborosqlが出力するログを抑止する.
26
         */
27
        default void suppressLogging() {
28
                MDC.put(SUPPRESS_LOG_OUTPUT, SUPPRESS_LOG_OUTPUT);
1✔
29
        }
1✔
30

31
        /**
32
         * Uroborosqlが出力するログが抑止されているかを返す.
33
         * @return ログが抑止されている場合<code>true</code>
34
         */
35
        default boolean isSuppressLogging() {
36
                return MDC.get(SUPPRESS_LOG_OUTPUT) != null;
1✔
37
        }
38

39
        /**
40
         * Uroborosqlが出力するログが抑止されている場合、抑止を終了する.
41
         */
42
        default void releaseLogging() {
43
                MDC.remove(SUPPRESS_LOG_OUTPUT);
1✔
44
        }
1✔
45

46
        /**
47
         * Uroborosqlが出力するパラメータログを抑止する.
48
         */
49
        default void suppressParameterLogging() {
50
                MDC.put(SUPPRESS_PARAMETER_LOG_OUTPUT, SUPPRESS_PARAMETER_LOG_OUTPUT);
1✔
51
        }
1✔
52

53
        /**
54
         * Uroborosqlが出力するパラメータログが抑止されているかを返す.
55
         * @return パラメータログが抑止されている場合<code>true</code>
56
         */
57
        default boolean isSuppressParameterLogging() {
58
                return MDC.get(SUPPRESS_PARAMETER_LOG_OUTPUT) != null;
1✔
59
        }
60

61
        /**
62
         * Uroborosqlが出力するパラメータログが抑止されている場合、抑止を終了する.
63
         */
64
        default void releaseParameterLogging() {
65
                MDC.remove(SUPPRESS_PARAMETER_LOG_OUTPUT);
1✔
66
        }
1✔
67

68
        /**
69
         * ERRORレベルの fluent-logging エントリーポイント. ログ抑止されている場合は出力しない.
70
         * @param logger ログ出力するためのロガー
71
         * @return ERRORレベルに適したLoggingEventBuilderインスタンス
72
         */
73
        default LoggingEventBuilder errorWith(final Logger logger) {
74
                if (!isSuppressLogging()) {
1✔
75
                        return logger.atError();
1✔
76
                } else {
NEW
77
                        return NOPLoggingEventBuilder.singleton();
×
78
                }
79
        }
80

81
        /**
82
         * WARNレベルの fluent-logging エントリーポイント. ログ抑止されている場合は出力しない.
83
         * @param logger ログ出力するためのロガー
84
         * @return WARNレベルに適したLoggingEventBuilderインスタンス
85
         */
86
        default LoggingEventBuilder warnWith(final Logger logger) {
87
                if (!isSuppressLogging()) {
1✔
88
                        return logger.atWarn();
1✔
89
                } else {
NEW
90
                        return NOPLoggingEventBuilder.singleton();
×
91
                }
92
        }
93

94
        /**
95
         * INFOレベルの fluent-logging エントリーポイント. ログ抑止されている場合は出力しない.
96
         * @param logger ログ出力するためのロガー
97
         * @return INFOレベルに適したLoggingEventBuilderインスタンス
98
         */
99
        default LoggingEventBuilder infoWith(final Logger logger) {
100
                if (!isSuppressLogging()) {
1✔
101
                        return logger.atInfo();
1✔
102
                } else {
103
                        return NOPLoggingEventBuilder.singleton();
1✔
104
                }
105
        }
106

107
        /**
108
         * DEBUGレベルの fluent-logging エントリーポイント. ログ抑止されている場合は出力しない.
109
         * @param logger ログ出力するためのロガー
110
         * @return DEBUGレベルに適したLoggingEventBuilderインスタンス
111
         */
112
        default LoggingEventBuilder debugWith(final Logger logger) {
113
                if (!isSuppressLogging()) {
1✔
114
                        return logger.atDebug();
1✔
115
                } else {
116
                        return NOPLoggingEventBuilder.singleton();
1✔
117
                }
118
        }
119

120
        /**
121
         * TRACEレベルの fluent-logging エントリーポイント. ログ抑止されている場合は出力しない.
122
         * @param logger ログ出力するためのロガー
123
         * @return TRACEレベルに適したLoggingEventBuilderインスタンス
124
         */
125
        default LoggingEventBuilder traceWith(final Logger logger) {
126
                if (!isSuppressLogging()) {
1✔
127
                        return logger.atTrace();
1✔
128
                } else {
NEW
129
                        return NOPLoggingEventBuilder.singleton();
×
130
                }
131
        }
132
}
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