aboutsummaryrefslogtreecommitdiff
path: root/host/common/log.cc
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2024-03-06 09:30:16 -0800
committerXin Li <delphij@google.com>2024-03-06 18:58:28 -0800
commitf9f9e408926547de6b5be9bb3ea3e360d50355ef (patch)
treeee974ce310f9e840cbb95064d76f3c04ca237849 /host/common/log.cc
parent1c4892a15a60d1865ea9113ea1fee60e81a4ce9d (diff)
parent8253c8af1f7026b8b7043343d21806a9dd660d07 (diff)
downloadchre-f9f9e408926547de6b5be9bb3ea3e360d50355ef.tar.gz
Merge Android 14 QPR2 to AOSP main
Bug: 319669529 Merged-In: Ia6da0c8a2d5ee52da203f40c1e0b075392985177 Change-Id: I966ced5edda74051a4513eae42adf380ea188b5b
Diffstat (limited to 'host/common/log.cc')
-rw-r--r--host/common/log.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/host/common/log.cc b/host/common/log.cc
new file mode 100644
index 00000000..8f3249ff
--- /dev/null
+++ b/host/common/log.cc
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cstdio>
+
+#include "chre_host/log.h"
+
+namespace android::chre {
+
+void outputHostLog(int priority, FILE *stream, const char *format,
+ const char *func, unsigned int line, ...) {
+ va_list args;
+ va_start(args, line);
+ LOG_PRI_VA(priority, LOG_TAG, format, args);
+ va_end(args);
+ va_start(args, line);
+ fprintf(stream, "%s:%d: ", func, line);
+ vfprintf(stream, format, args);
+ fprintf(stream, "\n");
+ fflush(stream); // flush the buffer to print out the log immediately
+ va_end(args);
+}
+
+} // namespace android::chre \ No newline at end of file