mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 20:05:35 +02:00
Terminal: Enable terminal logging only if any terminal tracing option is
enabled and the bundle state location can be determined
This commit is contained in:
parent
54b71c9c08
commit
40af8fd24c
3 changed files with 22 additions and 11 deletions
|
@ -1,2 +1,3 @@
|
||||||
|
org.eclipse.tm.terminal/debug/log = false
|
||||||
org.eclipse.tm.terminal/debug/log/char = false
|
org.eclipse.tm.terminal/debug/log/char = false
|
||||||
org.eclipse.tm.terminal/debug/log/VT100Backend = false
|
org.eclipse.tm.terminal/debug/log/VT100Backend = false
|
||||||
|
|
|
@ -152,7 +152,7 @@ public class VT100Emulator implements ControlListener {
|
||||||
ansiParameters[i] = new StringBuffer();
|
ansiParameters[i] = new StringBuffer();
|
||||||
}
|
}
|
||||||
setInputStreamReader(reader);
|
setInputStreamReader(reader);
|
||||||
if(TerminalPlugin.isOptionEnabled("org.eclipse.tm.terminal/debug/log/VT100Backend")) //$NON-NLS-1$
|
if(TerminalPlugin.isOptionEnabled(Logger.TRACE_DEBUG_LOG_VT100BACKEND)) //$NON-NLS-1$
|
||||||
text=new VT100BackendTraceDecorator(new VT100EmulatorBackend(data),System.out);
|
text=new VT100BackendTraceDecorator(new VT100EmulatorBackend(data),System.out);
|
||||||
else
|
else
|
||||||
text=new VT100EmulatorBackend(data);
|
text=new VT100EmulatorBackend(data);
|
||||||
|
|
|
@ -42,11 +42,20 @@ import org.eclipse.tm.internal.terminal.control.impl.TerminalPlugin;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
public final class Logger {
|
public final class Logger {
|
||||||
|
public static final String TRACE_DEBUG_LOG = "org.eclipse.tm.terminal/debug/log"; //$NON-NLS-1$
|
||||||
public static final String TRACE_DEBUG_LOG_CHAR = "org.eclipse.tm.terminal/debug/log/char"; //$NON-NLS-1$
|
public static final String TRACE_DEBUG_LOG_CHAR = "org.eclipse.tm.terminal/debug/log/char"; //$NON-NLS-1$
|
||||||
|
public static final String TRACE_DEBUG_LOG_VT100BACKEND = "org.eclipse.tm.terminal/debug/log/VT100Backend"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static PrintStream logStream;
|
private static PrintStream logStream;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
// Any of the three known debugging options turns on the creation of the log file
|
||||||
|
boolean createLogFile = TerminalPlugin.isOptionEnabled(TRACE_DEBUG_LOG)
|
||||||
|
|| TerminalPlugin.isOptionEnabled(TRACE_DEBUG_LOG_CHAR)
|
||||||
|
|| TerminalPlugin.isOptionEnabled(TRACE_DEBUG_LOG_VT100BACKEND);
|
||||||
|
|
||||||
|
// Log only if tracing is enabled
|
||||||
|
if (createLogFile && TerminalPlugin.getDefault() != null) {
|
||||||
IPath logFile = Platform.getStateLocation(TerminalPlugin.getDefault().getBundle());
|
IPath logFile = Platform.getStateLocation(TerminalPlugin.getDefault().getBundle());
|
||||||
if (logFile != null && logFile.toFile().isDirectory()) {
|
if (logFile != null && logFile.toFile().isDirectory()) {
|
||||||
logFile = logFile.append("tmterminal.log"); //$NON-NLS-1$
|
logFile = logFile.append("tmterminal.log"); //$NON-NLS-1$
|
||||||
|
@ -59,6 +68,7 @@ public final class Logger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encodes a String such that non-printable control characters are
|
* Encodes a String such that non-printable control characters are
|
||||||
|
|
Loading…
Add table
Reference in a new issue