本文整理了Java中jline.internal.Log
类的一些代码示例,展示了Log
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Log
类的具体详情如下:
包路径:jline.internal.Log
类名称:Log
[英]Internal logger.
[中]内部记录器。
代码示例来源:origin: jline/jline
private static synchronized void runTasks() {
Log.debug("Running all shutdown-hook tasks");
// Iterate through copy of tasks list
for (Task task : tasks.toArray(new Task[tasks.size()])) {
Log.debug("Running task: ", task);
try {
task.run();
}
catch (Throwable e) {
Log.warn("Task failed", e);
}
}
tasks.clear();
}
代码示例来源:origin: jline/jline
public void enableInterruptCharacter()
{
try {
if (intr != null) {
settings.set("intr", intr);
}
}
catch (Exception e) {
if (e instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
Log.error("Failed to enable interrupt character", e);
}
}
代码示例来源:origin: micronaut-projects/micronaut-core
/**
* Create a console reader.
*
* @param systemIn The input stream
* @return The console reader
* @throws IOException if there is an error
*/
protected ConsoleReader createConsoleReader(InputStream systemIn) throws IOException {
// need to swap out the output to avoid logging during init
final PrintStream nullOutput = new PrintStream(new ByteArrayOutputStream());
final PrintStream originalOut = Log.getOutput();
try {
Log.setOutput(nullOutput);
ConsoleReader consoleReader = new ConsoleReader(systemIn, out);
consoleReader.setExpandEvents(false);
return consoleReader;
} finally {
Log.setOutput(originalOut);
}
}
代码示例来源:origin: jline/jline
public void purge() throws IOException {
Log.trace("Purging history");
clear();
if (!file.delete()) {
Log.warn("Failed to delete history file: ", file);
}
}
}
代码示例来源:origin: jline/jline
/**
* Whether or not to allow the use of the JNI console interaction.
*/
public void setDirectConsole(final boolean flag) {
this.directConsole = flag;
Log.debug("Direct console: ", flag);
}
代码示例来源:origin: jline/jline
public static synchronized Terminal create(String ttyDevice) {
if (Log.TRACE) {
Log.trace(new Throwable("CREATE MARKER"));
String type = Configuration.getString(JLINE_TERMINAL, defaultType);
Log.debug("Creating terminal; type=", type);
Log.error("Failed to construct terminal; falling back to unsupported", e);
t = new UnsupportedTerminal();
Log.debug("Created Terminal: ", t);
Log.error("Terminal initialization failed; falling back to unsupported", e);
return new UnsupportedTerminal();
代码示例来源:origin: jline/jline
public void load(final File file) throws IOException {
checkNotNull(file);
if (file.exists()) {
Log.trace("Loading history from: ", file);
FileReader reader = null;
try{
reader = new FileReader(file);
load(reader);
} finally{
if(reader != null){
reader.close();
}
}
}
}
代码示例来源:origin: jline/jline
public OSvTerminal() {
super(true);
setAnsiSupported(true);
try {
if (stty == null) {
sttyClass = Class.forName("com.cloudius.util.Stty");
stty = sttyClass.newInstance();
}
} catch (Exception e) {
Log.warn("Failed to load com.cloudius.util.Stty", e);
}
}
代码示例来源:origin: jline/jline
keys.bind(keySeq, Operation.valueOf(operationName));
} catch(IllegalArgumentException e) {
Log.info("Unable to bind key for unsupported operation: ", val);
Log.warn("Unable to parse user configuration: ", e);
代码示例来源:origin: com.oracle.substratevm/library-support
@SuppressWarnings("unused")
@Substitute
public static Terminal create(String ttyDevice) {
Terminal t;
try {
t = new UnixTerminal();
t.init();
} catch (Exception e) {
Log.error("Failed to construct terminal; falling back to UnsupportedTerminal", e);
t = new UnsupportedTerminal();
}
Log.debug("Created Terminal: ", t);
return t;
}
}
代码示例来源:origin: jline/jline
/**
* @since 2.7
*/
public static void info(final Object... messages) {
log(Level.INFO, messages);
}
代码示例来源:origin: jline/jline
static void logWithJul(Level level, Object... messages) {
Logger logger = Logger.getLogger("jline");
Throwable cause = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
for (int i = 0; i < messages.length; i++) {
// Special handling for the last message if its a throwable, render its stack on the next line
if (i + 1 == messages.length && messages[i] instanceof Throwable) {
cause = (Throwable) messages[i];
}
else {
render(ps, messages[i]);
}
}
ps.close();
LogRecord r = new LogRecord(toJulLevel(level), baos.toString());
r.setThrown(cause);
logger.log(r);
}
代码示例来源:origin: jline/jline
@TestAccessible
static void log(final Level level, final Object... messages) {
if (useJul) {
logWithJul(level, messages);
return;
}
//noinspection SynchronizeOnNonFinalField
synchronized (output) {
output.format("[%s] ", level);
for (int i=0; i<messages.length; i++) {
// Special handling for the last message if its a throwable, render its stack on the next line
if (i + 1 == messages.length && messages[i] instanceof Throwable) {
output.println();
((Throwable)messages[i]).printStackTrace(output);
}
else {
render(output, messages[i]);
}
}
output.println();
output.flush();
}
}
代码示例来源:origin: apache/phoenix
List<RegionInfo> regions =
admin.getRegions(indexTable);
Log.info("Merging: " + regions.size());
admin.mergeRegionsAsync(regions.get(0).getEncodedNameAsBytes(),
regions.get(1).getEncodedNameAsBytes(), false);
Log.info(ex);
Log.info("Waiting:" + regions.size());
if (regions.size() < numRegions) {
break;
代码示例来源:origin: org.codehaus.izpack/izpack-util
/**
* Constructs a <tt>Console</tt> with <tt>System.in</tt> and <tt>System.out</tt> as the I/O streams.
*/
public Console(InstallData installData, ConsolePrefs prefs)
{
this.installData = installData;
Log.setOutput(new PrintStream(new OutputStream() {
@Override
public void write(int b) throws IOException
{
}
}));
if (prefs.enableConsoleReader)
{
initConsoleReader();
}
if (consoleReader == null)
{
console = System.console();
}
}
代码示例来源:origin: jline/jline
protected synchronized void setAnsiSupported(final boolean supported) {
this.ansiSupported = supported;
Log.debug("Ansi supported: ", supported);
}
代码示例来源:origin: com.typesafe.sbt/incremental-compiler
public static synchronized Terminal create(String ttyDevice) {
if (Log.TRACE) {
Log.trace(new Throwable("CREATE MARKER"));
Log.debug("Creating terminal; type=", type);
Log.error("Failed to construct terminal; falling back to unsupported", e);
t = new UnsupportedTerminal();
Log.debug("Created Terminal: ", t);
Log.error("Terminal initialization failed; falling back to unsupported", e);
return new UnsupportedTerminal();
代码示例来源:origin: jline/jline
public void flush() throws IOException {
Log.trace("Flushing history");
if (!file.exists()) {
File dir = file.getParentFile();
if (!dir.exists() && !dir.mkdirs()) {
Log.warn("Failed to create directory: ", dir);
}
if (!file.createNewFile()) {
Log.warn("Failed to create file: ", file);
}
}
PrintStream out = new PrintStream(new BufferedOutputStream(new FileOutputStream(file)));
try {
for (Entry entry : this) {
out.println(entry.value());
}
}
finally {
out.close();
}
}
代码示例来源:origin: jline/jline
private String exec(final String... cmd) throws IOException, InterruptedException {
checkNotNull(cmd);
Log.trace("Running: ", cmd);
Process p = null;
if (useRedirect) {
try {
p = inheritInput(new ProcessBuilder(cmd)).start();
} catch (Throwable t) {
useRedirect = false;
}
}
if (p == null) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < cmd.length; i++) {
if (i > 0) {
sb.append(' ');
}
sb.append(cmd[i]);
}
sb.append(" < ");
sb.append(ttyDevice);
p = new ProcessBuilder(shCommand, "-c", sb.toString()).start();
}
String result = waitAndCapture(p);
Log.trace("Result: ", result);
return result;
}
代码示例来源:origin: com.typesafe.sbt/incremental-compiler
public OSvTerminal() {
super(true);
setAnsiSupported(true);
try {
if (stty == null) {
sttyClass = Class.forName("com.cloudius.util.Stty");
stty = sttyClass.newInstance();
}
} catch (Exception e) {
Log.warn("Failed to load com.cloudius.util.Stty", e);
}
}
内容来源于网络,如有侵权,请联系作者删除!