use of com.android.internal.util.LineBreakBufferedWriter in project android_frameworks_base by ResurrectionRemix.
the class Log method printlns.
/**
* Helper function for long messages. Uses the LineBreakBufferedWriter to break
* up long messages and stacktraces along newlines, but tries to write in large
* chunks. This is to avoid truncation.
* @hide
*/
public static int printlns(int bufID, int priority, String tag, String msg, Throwable tr) {
ImmediateLogWriter logWriter = new ImmediateLogWriter(bufID, priority, tag);
// Acceptable buffer size. Get the native buffer size, subtract two zero terminators,
// and the length of the tag.
// Note: we implicitly accept possible truncation for Modified-UTF8 differences. It
// is too expensive to compute that ahead of time.
int bufferSize = // Base.
NoPreloadHolder.LOGGER_ENTRY_MAX_PAYLOAD - // Two terminators.
2 - // Tag length.
(tag != null ? tag.length() : 0) - // Some slack.
32;
// At least assume you can print *some* characters (tag is not too large).
bufferSize = Math.max(bufferSize, 100);
LineBreakBufferedWriter lbbw = new LineBreakBufferedWriter(logWriter, bufferSize);
lbbw.println(msg);
if (tr != null) {
// This is to reduce the amount of log spew that apps do in the non-error
// condition of the network being unavailable.
Throwable t = tr;
while (t != null) {
if (t instanceof UnknownHostException) {
break;
}
if (t instanceof DeadSystemException) {
lbbw.println("DeadSystemException: The system died; " + "earlier logs will point to the root cause");
break;
}
t = t.getCause();
}
if (t == null) {
tr.printStackTrace(lbbw);
}
}
lbbw.flush();
return logWriter.getWritten();
}
use of com.android.internal.util.LineBreakBufferedWriter in project android_frameworks_base by AOSPA.
the class Log method printlns.
/**
* Helper function for long messages. Uses the LineBreakBufferedWriter to break
* up long messages and stacktraces along newlines, but tries to write in large
* chunks. This is to avoid truncation.
* @hide
*/
public static int printlns(int bufID, int priority, String tag, String msg, Throwable tr) {
ImmediateLogWriter logWriter = new ImmediateLogWriter(bufID, priority, tag);
// Acceptable buffer size. Get the native buffer size, subtract two zero terminators,
// and the length of the tag.
// Note: we implicitly accept possible truncation for Modified-UTF8 differences. It
// is too expensive to compute that ahead of time.
int bufferSize = // Base.
NoPreloadHolder.LOGGER_ENTRY_MAX_PAYLOAD - // Two terminators.
2 - // Tag length.
(tag != null ? tag.length() : 0) - // Some slack.
32;
// At least assume you can print *some* characters (tag is not too large).
bufferSize = Math.max(bufferSize, 100);
LineBreakBufferedWriter lbbw = new LineBreakBufferedWriter(logWriter, bufferSize);
lbbw.println(msg);
if (tr != null) {
// This is to reduce the amount of log spew that apps do in the non-error
// condition of the network being unavailable.
Throwable t = tr;
while (t != null) {
if (t instanceof UnknownHostException) {
break;
}
if (t instanceof DeadSystemException) {
lbbw.println("DeadSystemException: The system died; " + "earlier logs will point to the root cause");
break;
}
t = t.getCause();
}
if (t == null) {
tr.printStackTrace(lbbw);
}
}
lbbw.flush();
return logWriter.getWritten();
}
use of com.android.internal.util.LineBreakBufferedWriter in project platform_frameworks_base by android.
the class Log method printlns.
/**
* Helper function for long messages. Uses the LineBreakBufferedWriter to break
* up long messages and stacktraces along newlines, but tries to write in large
* chunks. This is to avoid truncation.
* @hide
*/
public static int printlns(int bufID, int priority, String tag, String msg, Throwable tr) {
ImmediateLogWriter logWriter = new ImmediateLogWriter(bufID, priority, tag);
// Acceptable buffer size. Get the native buffer size, subtract two zero terminators,
// and the length of the tag.
// Note: we implicitly accept possible truncation for Modified-UTF8 differences. It
// is too expensive to compute that ahead of time.
int bufferSize = // Base.
NoPreloadHolder.LOGGER_ENTRY_MAX_PAYLOAD - // Two terminators.
2 - // Tag length.
(tag != null ? tag.length() : 0) - // Some slack.
32;
// At least assume you can print *some* characters (tag is not too large).
bufferSize = Math.max(bufferSize, 100);
LineBreakBufferedWriter lbbw = new LineBreakBufferedWriter(logWriter, bufferSize);
lbbw.println(msg);
if (tr != null) {
// This is to reduce the amount of log spew that apps do in the non-error
// condition of the network being unavailable.
Throwable t = tr;
while (t != null) {
if (t instanceof UnknownHostException) {
break;
}
if (t instanceof DeadSystemException) {
lbbw.println("DeadSystemException: The system died; " + "earlier logs will point to the root cause");
break;
}
t = t.getCause();
}
if (t == null) {
tr.printStackTrace(lbbw);
}
}
lbbw.flush();
return logWriter.getWritten();
}
use of com.android.internal.util.LineBreakBufferedWriter in project android_frameworks_base by crdroidandroid.
the class Log method printlns.
/**
* Helper function for long messages. Uses the LineBreakBufferedWriter to break
* up long messages and stacktraces along newlines, but tries to write in large
* chunks. This is to avoid truncation.
* @hide
*/
public static int printlns(int bufID, int priority, String tag, String msg, Throwable tr) {
ImmediateLogWriter logWriter = new ImmediateLogWriter(bufID, priority, tag);
// Acceptable buffer size. Get the native buffer size, subtract two zero terminators,
// and the length of the tag.
// Note: we implicitly accept possible truncation for Modified-UTF8 differences. It
// is too expensive to compute that ahead of time.
int bufferSize = // Base.
NoPreloadHolder.LOGGER_ENTRY_MAX_PAYLOAD - // Two terminators.
2 - // Tag length.
(tag != null ? tag.length() : 0) - // Some slack.
32;
// At least assume you can print *some* characters (tag is not too large).
bufferSize = Math.max(bufferSize, 100);
LineBreakBufferedWriter lbbw = new LineBreakBufferedWriter(logWriter, bufferSize);
lbbw.println(msg);
if (tr != null) {
// This is to reduce the amount of log spew that apps do in the non-error
// condition of the network being unavailable.
Throwable t = tr;
while (t != null) {
if (t instanceof UnknownHostException) {
break;
}
if (t instanceof DeadSystemException) {
lbbw.println("DeadSystemException: The system died; " + "earlier logs will point to the root cause");
break;
}
t = t.getCause();
}
if (t == null) {
tr.printStackTrace(lbbw);
}
}
lbbw.flush();
return logWriter.getWritten();
}
use of com.android.internal.util.LineBreakBufferedWriter in project android_frameworks_base by DirtyUnicorns.
the class Log method printlns.
/**
* Helper function for long messages. Uses the LineBreakBufferedWriter to break
* up long messages and stacktraces along newlines, but tries to write in large
* chunks. This is to avoid truncation.
* @hide
*/
public static int printlns(int bufID, int priority, String tag, String msg, Throwable tr) {
ImmediateLogWriter logWriter = new ImmediateLogWriter(bufID, priority, tag);
// Acceptable buffer size. Get the native buffer size, subtract two zero terminators,
// and the length of the tag.
// Note: we implicitly accept possible truncation for Modified-UTF8 differences. It
// is too expensive to compute that ahead of time.
int bufferSize = // Base.
NoPreloadHolder.LOGGER_ENTRY_MAX_PAYLOAD - // Two terminators.
2 - // Tag length.
(tag != null ? tag.length() : 0) - // Some slack.
32;
// At least assume you can print *some* characters (tag is not too large).
bufferSize = Math.max(bufferSize, 100);
LineBreakBufferedWriter lbbw = new LineBreakBufferedWriter(logWriter, bufferSize);
lbbw.println(msg);
if (tr != null) {
// This is to reduce the amount of log spew that apps do in the non-error
// condition of the network being unavailable.
Throwable t = tr;
while (t != null) {
if (t instanceof UnknownHostException) {
break;
}
if (t instanceof DeadSystemException) {
lbbw.println("DeadSystemException: The system died; " + "earlier logs will point to the root cause");
break;
}
t = t.getCause();
}
if (t == null) {
tr.printStackTrace(lbbw);
}
}
lbbw.flush();
return logWriter.getWritten();
}
Aggregations