All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.eworkcloud.log.LoghubAppenderCallback Maven / Gradle / Ivy

There is a newer version: 2.2.1
Show newest version
package com.eworkcloud.log;

import com.aliyun.openservices.aliyun.log.producer.Callback;
import com.aliyun.openservices.aliyun.log.producer.Result;
import com.aliyun.openservices.log.common.LogItem;

import java.util.List;

public class LoghubAppenderCallback implements Callback {

    private LoghubAppender loghubAppender;
    private String project;
    private String logStore;
    private String topic;
    private String source;
    private List logItems;

    public LoghubAppenderCallback(LoghubAppender loghubAppender, String project, String logStore,
                                  String topic, String source, List logItems) {
        super();
        this.loghubAppender = loghubAppender;
        this.project = project;
        this.logStore = logStore;
        this.topic = topic;
        this.source = source;
        this.logItems = logItems;
    }

    @Override
    public void onCompletion(Result result) {
        if (!result.isSuccessful()) {
            loghubAppender.addError(
                    "Failed to send log, project=" + project
                            + ", logStore=" + logStore
                            + ", topic=" + topic
                            + ", source=" + source
                            + ", logItem=" + logItems
                            + ", errorCode=" + result.getErrorCode()
                            + ", errorMessage=" + result.getErrorMessage());
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy