1 /* 2 * Copyright (C) 2005-2016 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 /* Special log_event_list.h file for VNDK linking modules */ 18 19 #ifndef _LIBS_LOG_EVENT_LIST_H 20 #define _LIBS_LOG_EVENT_LIST_H 21 22 #include <stdint.h> 23 24 #include <log/log_id.h> 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 /* 31 * The opaque context used to manipulate lists of events. 32 */ 33 #ifndef __android_log_context_defined 34 #define __android_log_context_defined 35 typedef struct android_log_context_internal* android_log_context; 36 #endif 37 38 /* 39 * Creates a context associated with an event tag to write elements to 40 * the list of events. 41 */ 42 android_log_context create_android_logger(uint32_t tag); 43 44 /* All lists must be braced by a begin and end call */ 45 /* 46 * NB: If the first level braces are missing when specifying multiple 47 * elements, we will manufacturer a list to embrace it for your API 48 * convenience. For a single element, it will remain solitary. 49 */ 50 int android_log_write_list_begin(android_log_context ctx); 51 int android_log_write_list_end(android_log_context ctx); 52 53 int android_log_write_int32(android_log_context ctx, int32_t value); 54 int android_log_write_int64(android_log_context ctx, int64_t value); 55 int android_log_write_string8(android_log_context ctx, const char* value); 56 int android_log_write_string8_len(android_log_context ctx, const char* value, 57 size_t maxlen); 58 int android_log_write_float32(android_log_context ctx, float value); 59 60 /* Submit the composed list context to the specified logger id */ 61 /* NB: LOG_ID_EVENTS and LOG_ID_SECURITY only valid binary buffers */ 62 int android_log_write_list(android_log_context ctx, log_id_t id); 63 64 /* Reset writer context */ 65 int android_log_reset(android_log_context ctx); 66 67 /* Reset reader context */ 68 int android_log_parser_reset(android_log_context ctx, 69 const char* msg, size_t len); 70 71 /* Finished with reader or writer context */ 72 int android_log_destroy(android_log_context* ctx); 73 74 #ifdef __cplusplus 75 } 76 #endif 77 78 #endif /* _LIBS_LOG_EVENT_LIST_H */ 79