summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/utils/EventLogger.java92
1 files changed, 46 insertions, 46 deletions
diff --git a/services/core/java/com/android/server/utils/EventLogger.java b/services/core/java/com/android/server/utils/EventLogger.java
index f3a60cee8728..45b4ff8e1832 100644
--- a/services/core/java/com/android/server/utils/EventLogger.java
+++ b/services/core/java/com/android/server/utils/EventLogger.java
@@ -46,6 +46,52 @@ public class EventLogger {
*/
private final int mMemSize;
+ /**
+ * Constructor for logger.
+ * @param size the maximum number of events to keep in log
+ * @param tag the string displayed before the recorded log
+ */
+ public EventLogger(int size, String tag) {
+ mEvents = new LinkedList<Event>();
+ mMemSize = size;
+ mTag = tag;
+ }
+
+ public synchronized void log(Event evt) {
+ if (mEvents.size() >= mMemSize) {
+ mEvents.removeFirst();
+ }
+ mEvents.add(evt);
+ }
+
+ /**
+ * Add a string-based event to the log, and print it to logcat as info.
+ * @param msg the message for the logs
+ * @param tag the logcat tag to use
+ */
+ public synchronized void loglogi(String msg, String tag) {
+ final Event event = new StringEvent(msg);
+ log(event.printLog(tag));
+ }
+
+ /**
+ * Same as {@link #loglogi(String, String)} but specifying the logcat type
+ * @param msg the message for the logs
+ * @param logType the type of logcat entry
+ * @param tag the logcat tag to use
+ */
+ public synchronized void loglog(String msg, @Event.LogType int logType, String tag) {
+ final Event event = new StringEvent(msg);
+ log(event.printLog(logType, tag));
+ }
+
+ public synchronized void dump(PrintWriter pw) {
+ pw.println("Events log: " + mTag);
+ for (Event evt : mEvents) {
+ pw.println(evt.toString());
+ }
+ }
+
public abstract static class Event {
/** Timestamps formatter. */
@@ -141,50 +187,4 @@ public class EventLogger {
return mMsg;
}
}
-
- /**
- * Constructor for logger.
- * @param size the maximum number of events to keep in log
- * @param tag the string displayed before the recorded log
- */
- public EventLogger(int size, String tag) {
- mEvents = new LinkedList<Event>();
- mMemSize = size;
- mTag = tag;
- }
-
- public synchronized void log(Event evt) {
- if (mEvents.size() >= mMemSize) {
- mEvents.removeFirst();
- }
- mEvents.add(evt);
- }
-
- /**
- * Add a string-based event to the log, and print it to logcat as info.
- * @param msg the message for the logs
- * @param tag the logcat tag to use
- */
- public synchronized void loglogi(String msg, String tag) {
- final Event event = new StringEvent(msg);
- log(event.printLog(tag));
- }
-
- /**
- * Same as {@link #loglogi(String, String)} but specifying the logcat type
- * @param msg the message for the logs
- * @param logType the type of logcat entry
- * @param tag the logcat tag to use
- */
- public synchronized void loglog(String msg, @Event.LogType int logType, String tag) {
- final Event event = new StringEvent(msg);
- log(event.printLog(logType, tag));
- }
-
- public synchronized void dump(PrintWriter pw) {
- pw.println("Events log: " + mTag);
- for (Event evt : mEvents) {
- pw.println(evt.toString());
- }
- }
}