3 * Copyright (c) 2005-2008, The Android Open Source Project
4 * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
26 #include <dlogutil-internal.h>
27 #include <logcommon.h>
28 #include <ptrs_list.h>
29 #include <queued_entry.h>
52 log_print_format format;
56 dlogutil_filter_options_s *log_filter_new();
58 void log_filter_free(dlogutil_filter_options_s *p_filter);
61 * Returns a deep copy of the passed object.
63 dlogutil_filter_options_s *log_filter_from_filter(const dlogutil_filter_options_s *p_filter);
65 dlogutil_filter_options_s *log_filter_move(dlogutil_filter_options_s *p_filter);
68 * Returns FORMAT_OFF on invalid string
70 log_print_format log_format_from_string(const char *s);
73 * filterExpression: a single filter expression
76 * returns 0 on success and -1 on invalid expression
78 * Assumes single threaded execution
82 int log_add_filter_rule(dlogutil_filter_options_s *p_filter, const char *filterExpression);
84 void log_filter_clear(dlogutil_filter_options_s *p_filter);
94 typedef struct FilterInfo_t {
101 struct tag_and_prio tnp;
107 list_head log_filter_get_list(dlogutil_filter_options_s *p_filter);
109 log_priority log_filter_get_global_priority(dlogutil_filter_options_s *p_filter, bool *is_exact);
111 bool log_filter_need_apply_default(dlogutil_filter_options_s *p_filter);
114 * returns true if this log line should be printed based on its entry
115 * data (priority, tag, pid and tid), and false if it should not
117 bool log_should_print_line(
118 dlogutil_filter_options_s *p_filter, const dlogutil_entry_s *entry);
121 * Formats a log message into a buffer
123 * Uses defaultBuffer if it can, otherwise malloc()'s a new buffer
124 * If return value != defaultBuffer, caller must call free()
125 * Returns NULL on malloc error
128 char *log_format_log_line(
129 const struct log_format p_format,
131 size_t defaultBufferSize,
132 const dlogutil_entry_s *p_line,
133 size_t *p_outLength);
136 * Either print or do not print log line, based on filter
138 * Assumes single threaded execution
141 int log_print_log_line(
142 struct log_format p_format,
144 const dlogutil_entry_s *entry);
146 dlogutil_sorting_order_e get_format_sorting(log_print_format format);
152 #endif /*_LOGPRINT_H*/