當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonWritingUtils類代碼示例

本文整理匯總了Java中net.logstash.logback.composite.JsonWritingUtils的典型用法代碼示例。如果您正苦於以下問題:Java JsonWritingUtils類的具體用法?Java JsonWritingUtils怎麽用?Java JsonWritingUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JsonWritingUtils類屬於net.logstash.logback.composite包,在下文中一共展示了JsonWritingUtils類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: writeTo

import net.logstash.logback.composite.JsonWritingUtils; //導入依賴的package包/類
@Override
public void writeTo(JsonGenerator generator, ILoggingEvent event) throws IOException {
    String level;
    switch (event.getLevel().toInt()) {
        case Level.ERROR_INT:
            level = "error";
            break;
        case Level.WARN_INT:
            level = "warning";
            break;
        case Level.INFO_INT:
            level = "info";
            break;
        case Level.DEBUG_INT:
            level = "debug";
            break;
        case Level.TRACE_INT:
            level = "trace";
            break;
        case Level.ALL_INT:
            level = "all";
            break;
        case Level.OFF_INT:
            level = "off";
            break;
        default:
            level = "???";
    }
    JsonWritingUtils.writeStringField(
            generator, getFieldName(), level);
}
 
開發者ID:Sixt,項目名稱:ja-micro,代碼行數:32,代碼來源:CustomLogLevelJsonProvider.java

示例2: writeTo

import net.logstash.logback.composite.JsonWritingUtils; //導入依賴的package包/類
@Override
public void writeTo(JsonGenerator generator, ILoggingEvent event) throws IOException {
    if (require) {
        ThrowableProxy proxy = (ThrowableProxy) event.getThrowableProxy();
        AbstractLoggingException exception = AbstractLoggingException.getFromThrowableProxy(proxy);

        if (exception != null) {
            JsonWritingUtils.writeStringField(generator, getFieldName(), getValue(exception));
        }
    }
}
 
開發者ID:hmcts,項目名稱:java-logging,代碼行數:12,代碼來源:AbstractRequireJsonProvider.java

示例3: writeTo

import net.logstash.logback.composite.JsonWritingUtils; //導入依賴的package包/類
@Override
public void writeTo(JsonGenerator jsonGen, ILoggingEvent event) throws IOException {
    Map<String, String> mdcProps = event.getMDCPropertyMap();

    if (mdcProps.isEmpty()) {
        return;
    }

    JsonWritingUtils.writeMapStringFields(jsonGen, this.getFieldName(),
        mdcProps.entrySet().stream().filter(mdcPropEntry -> StringUtils.startsWith(mdcPropEntry.getKey(), SdcctPropertyNames.PREFIX)).collect(
            SdcctStreamUtils.toMap(mdcPropEntry -> StringUtils.replaceChars(StringUtils.removeStart(mdcPropEntry.getKey(), SdcctPropertyNames.PREFIX),
                SdcctStringUtils.PERIOD_CHAR, SdcctStringUtils.UNDERSCORE_CHAR), Entry::getValue, TreeMap::new)));
}
 
開發者ID:esacinc,項目名稱:sdcct,代碼行數:14,代碼來源:SdcctMdcJsonProvider.java

示例4: writeTo

import net.logstash.logback.composite.JsonWritingUtils; //導入依賴的package包/類
@Override
public void writeTo(JsonGenerator jsonGen, ILoggingEvent event) throws IOException {
    MessageMarker msgMarker = SdcctStreamUtils.findInstance(SdcctMarkerUtils.stream(event.getMarker()), MessageMarker.class);

    if (msgMarker != null) {
        // noinspection ConstantConditions
        JsonWritingUtils.writeStringField(jsonGen, this.getFieldName(), msgMarker.getMessages().get(AppenderType.LOGSTASH_FILE));
    } else {
        super.writeTo(jsonGen, event);
    }
}
 
開發者ID:esacinc,項目名稱:sdcct,代碼行數:12,代碼來源:MessageMarkerJsonProvider.java


注:本文中的net.logstash.logback.composite.JsonWritingUtils類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。