mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
extract logger for process output
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user