extract logger for process output

This commit is contained in:
Dennis Ushakov
2018-03-06 17:33:57 +03:00
parent 717aeb5240
commit 41783b096b
2 changed files with 30 additions and 18 deletions
@@ -0,0 +1,27 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.execution.process;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Key;
import org.jetbrains.annotations.NotNull;
public class CommandOutputLogger extends ProcessAdapter {
private final Logger myLogger;
public CommandOutputLogger(Logger logger) {
myLogger = logger;
}
@Override
public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) {
String line = event.getText();
if (myLogger.isDebugEnabled()) {
myLogger.debug(line);
}
if (ApplicationManager.getApplication().isUnitTestMode()) {
System.out.print(line);
}
}
}
@@ -1,28 +1,13 @@
package org.jetbrains.idea.svn.commandLine;
import com.intellij.execution.process.ProcessAdapter;
import com.intellij.execution.process.ProcessEvent;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Key;
import org.jetbrains.annotations.NotNull;
/**
* @author Konstantin Kolosovsky.
*/
public class CommandOutputLogger extends ProcessAdapter {
public class CommandOutputLogger extends com.intellij.execution.process.CommandOutputLogger {
private static final Logger LOG = Logger.getInstance(CommandOutputLogger.class);
@Override
public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) {
String line = event.getText();
if (LOG.isDebugEnabled()) {
LOG.debug(line);
}
if (ApplicationManager.getApplication().isUnitTestMode()) {
System.out.print(line);
}
public CommandOutputLogger() {
super(LOG);
}
}