blob: 305f5f23a7a0d41b7bed16d777e2fb3571560f2f [file] [log] [blame]
Mathias Agopian7922fa22009-05-18 15:08:03 -07001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// All static variables go here, to control initialization and
18// destruction order in the library.
19
Martijn Coenene01f4f22016-05-12 12:33:28 +020020#include <hwbinder/Static.h>
Mathias Agopian7922fa22009-05-18 15:08:03 -070021
Steven Moreland507238e2020-07-14 22:12:20 +000022#include "BufferedTextOutput.h"
23
Martijn Coenen4080edc2016-05-04 14:17:02 +020024#include <hwbinder/IPCThreadState.h>
Mathias Agopian7922fa22009-05-18 15:08:03 -070025#include <utils/Log.h>
26
27namespace android {
Martijn Coenenf75a23d2016-08-01 11:55:17 +020028namespace hardware {
Mathias Agopian7922fa22009-05-18 15:08:03 -070029
Mathias Agopian4ea13dc2013-05-06 20:20:50 -070030// ------------ Text output streams
31
32Vector<int32_t> gTextBuffers;
33
34class LogTextOutput : public BufferedTextOutput
35{
36public:
37 LogTextOutput() : BufferedTextOutput(MULTITHREADED) { }
38 virtual ~LogTextOutput() { };
39
40protected:
41 virtual status_t writeLines(const struct iovec& vec, size_t N)
42 {
43 //android_writevLog(&vec, N); <-- this is now a no-op
44 if (N != 1) ALOGI("WARNING: writeLines N=%zu\n", N);
45 ALOGI("%.*s", (int)vec.iov_len, (const char*) vec.iov_base);
46 return NO_ERROR;
47 }
48};
49
Mathias Agopian4ea13dc2013-05-06 20:20:50 -070050static LogTextOutput gLogTextOutput;
Mathias Agopian4ea13dc2013-05-06 20:20:50 -070051TextOutput& alog(gLogTextOutput);
Mathias Agopian4ea13dc2013-05-06 20:20:50 -070052
Martijn Coenenf75a23d2016-08-01 11:55:17 +020053} // namespace hardware
Mathias Agopian7922fa22009-05-18 15:08:03 -070054} // namespace android