public List getListeners()

in tc-sbt-runner-agent/src/main/java/jetbrains/buildServer/sbt/SbtRunnerBuildService.java [77:109]


    public List<ProcessListener> getListeners() {
        return Collections.<ProcessListener>singletonList(new ProcessListenerAdapter() {
            boolean knownSectionStarts = false;

            @Override
            public void onStandardOutput(@NotNull String line) {
                if (!knownSectionStarts) {
                    //we need this otherwise we can hide important messages appeared before our own logger was started to print server messages
                    Matcher matcher = KNOWN_SECTION_MESSAGE.matcher(line);
                    if (matcher.find()) {
                        knownSectionStarts = true;
                    }
                }
                Matcher matcher = LINES_TO_EXCLUDE.matcher(line);
                if (matcher.find() && knownSectionStarts) {
                    //we don't want to duplicate lines
                    //sbt-tc-logger wraps WARN and ERROR messages
                    //we can exclude those messages from normal output
                    return;
                }
                getLogger().message(line);
            }

            public void onErrorOutput(@NotNull String line) {
                getLogger().warning(line);
            }

            @Override
            public void processFinished(int exitCode) {
                super.processFinished(exitCode);
            }
        });
    }