Refactor ErrorCounter out from timing report code

This is helpful to allow other applications to track error counts in a
similar manner.

Change-Id: Ifc7127578c08757febc6acdc3a79e42ad7b7cce5
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/util/BUILD b/aos/util/BUILD
index 0808062..5a87251 100644
--- a/aos/util/BUILD
+++ b/aos/util/BUILD
@@ -54,6 +54,28 @@
 )
 
 cc_library(
+    name = "error_counter",
+    hdrs = ["error_counter.h"],
+    target_compatible_with = ["@platforms//os:linux"],
+    deps = [
+        "@com_github_google_flatbuffers//:flatbuffers",
+        "@com_github_google_glog//:glog",
+    ],
+)
+
+cc_test(
+    name = "error_counter_test",
+    srcs = ["error_counter_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
+    deps = [
+        ":error_counter",
+        "//aos:flatbuffers",
+        "//aos/events:event_loop_fbs",
+        "//aos/testing:googletest",
+    ],
+)
+
+cc_library(
     name = "mcap_logger",
     srcs = ["mcap_logger.cc"],
     hdrs = ["mcap_logger.h"],