equal
deleted
inserted
replaced
159 public static final int EInfoHeavyLoad = 0x20; // Use HLOG(s) |
159 public static final int EInfoHeavyLoad = 0x20; // Use HLOG(s) |
160 |
160 |
161 //private static ByteArrayOutputStream byte_stream = new ByteArrayOutputStream(); |
161 //private static ByteArrayOutputStream byte_stream = new ByteArrayOutputStream(); |
162 //private static PrintStream print_stream = new PrintStream(byte_stream); |
162 //private static PrintStream print_stream = new PrintStream(byte_stream); |
163 |
163 |
|
164 private static boolean mNativeAvailable = false; |
|
165 |
164 static |
166 static |
165 { |
167 { |
166 |
168 |
167 try |
169 try |
168 { |
170 { |
169 Jvm.loadSystemLibrary("javautils"); |
171 Jvm.loadSystemLibrary("javautils"); |
170 } |
172 mNativeAvailable = true; |
171 |
173 } |
172 catch (Exception e) |
174 |
173 { |
175 catch (Throwable t) |
174 |
176 { |
175 System.err.println(e.toString()); |
177 System.err.println("Error loading javautils: " + t); |
176 } |
178 } |
177 } |
179 } |
178 |
180 |
179 /** |
181 /** |
180 * Logging function for error messages |
182 * Logging function for error messages |
343 { |
345 { |
344 ELOG(component, "str argument was null!", new NullPointerException()); |
346 ELOG(component, "str argument was null!", new NullPointerException()); |
345 } |
347 } |
346 else |
348 else |
347 { |
349 { |
348 _logging(component, level, str, DebugUtils.getStackTrace(thrown)); |
350 if (mNativeAvailable) |
|
351 { |
|
352 _logging(component, level, str, DebugUtils.getStackTrace(thrown)); |
|
353 } |
|
354 else |
|
355 { |
|
356 PrintStream printStream = System.out; |
|
357 if (level == EError || level == EWarning) |
|
358 { |
|
359 printStream = System.err; |
|
360 } |
|
361 printStream.println("Component: " + component + ", level: " + |
|
362 level + ", msg: " + str); |
|
363 if (thrown != null) |
|
364 { |
|
365 thrown.printStackTrace(); |
|
366 } |
|
367 } |
349 } |
368 } |
350 } |
369 } |
351 |
370 |
352 /** |
371 /** |
353 * Native function for printing a log with optional stack trace. |
372 * Native function for printing a log with optional stack trace. |