No wrapping unless asked to do so.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1323 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2003-11-25 02:12:45 +00:00
parent 8e6a001e3a
commit da9d7731da
@@ -1,5 +1,5 @@
//
// $Id: DefaultLogProvider.java,v 1.20 2003/07/11 21:00:30 mdb Exp $
// $Id: DefaultLogProvider.java,v 1.21 2003/11/25 02:12:45 mdb Exp $
//
// samskivert library - useful routines for java programs
// Copyright (C) 2001 Michael Bayne
@@ -54,6 +54,10 @@ public class DefaultLogProvider implements LogProvider
if (!StringUtil.blank(pstr)) {
_useVT100 = pstr.equalsIgnoreCase("true");
}
String wstr = System.getProperty("wrap_log");
if (!StringUtil.blank(wstr)) {
_wrapLog = wstr.equalsIgnoreCase("true");
}
} catch (SecurityException se) {
// nothing to worry about
@@ -129,6 +133,12 @@ public class DefaultLogProvider implements LogProvider
buf.append(_useVT100 ? TermUtil.UNDERLINE : "").append(moduleName);
buf.append(_useVT100 ? TermUtil.PLAIN : "").append(": ");
// if we're not wrapping, append the message and be done with it
if (!_wrapLog) {
buf.append(message);
return buf.toString();
}
// if the text contains newlines, use those instead of wrapping
if (message.indexOf("\n") != -1) {
String[] lines = StringUtil.split(message, "\n");
@@ -184,9 +194,6 @@ public class DefaultLogProvider implements LogProvider
}
}
/** Whether or not to use the vt100 escape codes. */
protected boolean _useVT100 = false;
/** The default log level. */
protected int _level = Log.INFO;
@@ -207,6 +214,12 @@ public class DefaultLogProvider implements LogProvider
* the default dimensions. This is used to wrap lines. */
protected static Dimension _tdimens;
/** Whether or not to use the vt100 escape codes. */
protected boolean _useVT100 = false;
/** Whether or not to wrap the log lines. */
protected boolean _wrapLog = false;
/** Used to tag log messages with their log level. */
protected static final String[] LEVEL_CHARS = { ".", "?", "!" };