2
* Copyright (C) 2006 The Android Open Source Project
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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
20
#include <cutils/log.h>
21
#include <cutils/logger.h>
22
#include <cutils/event_tag_map.h>
39
} AndroidLogPrintFormat;
41
typedef struct AndroidLogFormat_t AndroidLogFormat;
43
typedef struct AndroidLogEntry_t {
46
android_LogPriority priority;
54
AndroidLogFormat *android_log_format_new();
56
void android_log_format_free(AndroidLogFormat *p_format);
58
void android_log_setPrintFormat(AndroidLogFormat *p_format,
59
AndroidLogPrintFormat format);
62
* Returns FORMAT_OFF on invalid string
64
AndroidLogPrintFormat android_log_formatFromString(const char *s);
67
* filterExpression: a single filter expression
70
* returns 0 on success and -1 on invalid expression
72
* Assumes single threaded execution
76
int android_log_addFilterRule(AndroidLogFormat *p_format,
77
const char *filterExpression);
81
* filterString: a whitespace-separated set of filter expressions
84
* returns 0 on success and -1 on invalid expression
86
* Assumes single threaded execution
90
int android_log_addFilterString(AndroidLogFormat *p_format,
91
const char *filterString);
95
* returns 1 if this log line should be printed based on its priority
96
* and tag, and 0 if it should not
98
int android_log_shouldPrintLine (
99
AndroidLogFormat *p_format, const char *tag, android_LogPriority pri);
103
* Splits a wire-format buffer into an AndroidLogEntry
104
* entry allocated by caller. Pointers will point directly into buf
106
* Returns 0 on success and -1 on invalid wire format (entry will be
107
* in unspecified state)
109
int android_log_processLogBuffer(struct logger_entry *buf,
110
AndroidLogEntry *entry);
113
* Like android_log_processLogBuffer, but for binary logs.
115
* If "map" is non-NULL, it will be used to convert the log tag number
118
int android_log_processBinaryLogBuffer(struct logger_entry *buf,
119
AndroidLogEntry *entry, const EventTagMap* map, char* messageBuf,
124
* Formats a log message into a buffer
126
* Uses defaultBuffer if it can, otherwise malloc()'s a new buffer
127
* If return value != defaultBuffer, caller must call free()
128
* Returns NULL on malloc error
131
char *android_log_formatLogLine (
132
AndroidLogFormat *p_format,
134
size_t defaultBufferSize,
135
const AndroidLogEntry *p_line,
136
size_t *p_outLength);
140
* Either print or do not print log line, based on filter
142
* Assumes single threaded execution
145
int android_log_printLogLine(
146
AndroidLogFormat *p_format,
148
const AndroidLogEntry *entry);
156
#endif /*_LOGPRINT_H*/