- Add FileStreamFactory and I2PFile to deal with the problems from

the code CWD is / but the only writable directory is
  /data/data/net.i2p.router/files/ - still a ton of places to be
  fixed, will be fixed up as things get working
- Load some config files from resources at startup
- Fix up logging
- Add reseed capability, by copying some code over from routerconsole
- Deal with conflicting bouncycastle libs
This commit is contained in:
zzz
2009-03-13 18:56:16 +00:00
parent 5a8b3eb8f3
commit b8f22bf3bf
23 changed files with 437 additions and 54 deletions

View File

@@ -87,36 +87,44 @@ class LogWriter implements Runnable {
private void writeRecord(LogRecord rec) {
if (rec.getThrowable() == null)
log(rec.getPriority(), rec.getSourceName(), null, rec.getThreadName(), rec.getMessage());
log(rec.getPriority(), rec.getSource(), rec.getSourceName(), rec.getThreadName(), rec.getMessage());
else
log(rec.getPriority(), rec.getSourceName(), null, rec.getThreadName(), rec.getMessage(), rec.getThrowable());
log(rec.getPriority(), rec.getSource(), rec.getSourceName(), rec.getThreadName(), rec.getMessage(), rec.getThrowable());
}
public void log(int priority, String className, String name, String threadName, String msg) {
if (className != null)
public void log(int priority, Class src, String name, String threadName, String msg) {
if (src != null) {
String tag = src.getName();
int dot = tag.lastIndexOf(".");
if (dot >= 0)
tag = tag.substring(dot + 1);
android.util.Log.println(toAndroidLevel(priority),
className,
threadName + ' ' + msg);
else if (name != null)
tag,
'[' + threadName + "] " + msg);
} else if (name != null)
android.util.Log.println(toAndroidLevel(priority),
name,
threadName + ' ' + msg);
'[' + threadName + "] " + msg);
else
android.util.Log.println(toAndroidLevel(priority),
threadName, msg);
}
public void log(int priority, String className, String name, String threadName, String msg, Throwable t) {
if (className != null)
public void log(int priority, Class src, String name, String threadName, String msg, Throwable t) {
if (src != null) {
String tag = src.getName();
int dot = tag.lastIndexOf(".");
if (dot >= 0)
tag = tag.substring(dot + 1);
android.util.Log.println(toAndroidLevel(priority),
className,
threadName + ' ' + msg +
msg + ' ' + t.toString() + ' ' + android.util.Log.getStackTraceString(t));
else if (name != null)
tag,
'[' + threadName + "] " + msg +
' ' + t.toString() + ' ' + android.util.Log.getStackTraceString(t));
} else if (name != null)
android.util.Log.println(toAndroidLevel(priority),
name,
threadName + ' ' + msg +
msg + ' ' + t.toString() + ' ' + android.util.Log.getStackTraceString(t));
'[' + threadName + "] " + msg +
' ' + t.toString() + ' ' + android.util.Log.getStackTraceString(t));
else
android.util.Log.println(toAndroidLevel(priority),
threadName,