* @param[out] tid TID of the log sender
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER One of the pointers was NULL
* @retval TIZEN_ERROR_NO_DATA TID missing or not applicable
*/
int dlogutil_entry_get_tid(const dlogutil_entry_s *entry, pid_t *tid);
* @param[out] pid PID of the log sender
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER One of the pointers was NULL
* @retval TIZEN_ERROR_NO_DATA PID missing or not applicable
*/
int dlogutil_entry_get_pid(const dlogutil_entry_s *entry, pid_t *pid);
* @param[out] tag Log tag
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER One of the pointers was NULL
* @retval TIZEN_ERROR_NO_DATA The tag is missing
*/
int dlogutil_entry_get_tag(const dlogutil_entry_s *entry, const char **tag);
* @param[out] msg Log message
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER One of the pointers was NULL
* @retval TIZEN_ERROR_NO_DATA The message is missing
*/
int dlogutil_entry_get_message(const dlogutil_entry_s *entry, const char **msg);
* @param[out] ts Timestamp of the entry
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER Invalid value of order
+ * @retval TIZEN_ERROR_INVALID_PARAMETER One of the pointers was NULL
* @retval TIZEN_ERROR_NO_DATA The timestamp is missing
* @see dlogutil_get_traits()
*/
* @param[out] prio Log priority
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER One of the pointers was NULL
* @retval TIZEN_ERROR_NO_DATA The priority is missing
*/
int dlogutil_entry_get_priority(const dlogutil_entry_s *entry, log_priority *prio);
* @param[in] tid The TID value
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER The pointer was NULL
* @retval TIZEN_ERROR_OUT_OF_MEMORY Out of memory
*/
int dlogutil_filter_options_set_tid(dlogutil_filter_options_s *filter, pid_t tid);
* @param[in] pid The PID value.
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER The pointer was NULL
* @retval TIZEN_ERROR_OUT_OF_MEMORY Out of memory
*/
int dlogutil_filter_options_set_pid(dlogutil_filter_options_s *filter, pid_t pid);
* @return An error code
* @retval TIZEN_ERROR_NONE Success
* @retval TIZEN_ERROR_INVALID_PARAMETER Invalid syntax of the filterspec
+ * @retval TIZEN_ERROR_INVALID_PARAMETER One of the pointers was NULL
* @retval TIZEN_ERROR_OUT_OF_MEMORY Out of memory
*/
int dlogutil_filter_options_set_filterspec(dlogutil_filter_options_s *filter, const char *query);
* @param[in] sorting A handle to the settings struct
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER The pointer was NULL
* @see dlogutil_sorting_options_enable_sorting()
* @see dlogutil_sorting_options_enable_sorting_with_size()
*/
* @param[in] sorting A handle to the settings struct
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER The pointer was NULL
* @see dlogutil_sorting_options_disable_sorting()
* @see dlogutil_sorting_options_enable_sorting_with_size()
*/
* @param[in] entry_count How many logs to keep at a given time. At least 1
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER Zero size
+ * @retval TIZEN_ERROR_INVALID_PARAMETER The pointer was NULL
* @see dlogutil_sorting_options_disable_sorting()
* @see dlogutil_sorting_options_enable_sorting()
*/
* @param[in] sort_by Which timestamp type to sort by. #DLOGUTIL_SORT_DEFAULT is allowed
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER The pointer was NULL
*/
int dlogutil_sorting_options_set_sort_by(dlogutil_sorting_options_s *sorting, dlogutil_sorting_order_e sort_by);
* @param[in] filter Filter settings. Can be NULL, in which case we let everything through
* @return An error code, or the callback return value
* @retval TIZEN_ERROR_NONE Should never happen
+ * @retval TIZEN_ERROR_INVALID_PARAMETER Invalid buffer selection
+ * @retval TIZEN_ERROR_INVALID_PARAMETER The callback pointer was NULL
* @retval Other Either an arbitrary Tizen error code, or the callback return value
* @see #dlogutil_entry_cb
* @see dlogutil_get_logs_dump()
* @param[in] filter Filter settings. Can be NULL, in which case we let everything through
* @return An error code, or the callback return value
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER Invalid buffer selection
+ * @retval TIZEN_ERROR_INVALID_PARAMETER The callback pointer was NULL
* @retval Other Either an arbitrary Tizen error code, or the callback return value
* @see #dlogutil_entry_cb
* @see dlogutil_get_logs_continuous()
* @param[in] buffer A single buffer to be cleared
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER Invalid buffer
+ * @retval TIZEN_ERROR_INVALID_PARAMETER More than one buffer
* @retval Other An arbitrary Tizen error code
*/
int dlogutil_buffer_clear(dlogutil_buffer_e buffer);
* @param[out] name The name of the passed buffer
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER Invalid buffer
+ * @retval TIZEN_ERROR_INVALID_PARAMETER More than one buffer
+ * @retval TIZEN_ERROR_INVALID_PARAMETER The pointer was NULL
* @retval Other An arbitrary Tizen error code
*/
int dlogutil_buffer_get_name(dlogutil_buffer_e buffer, const char **name);
* @param[out] size The size in entries of the passed buffer
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER Invalid buffer
+ * @retval TIZEN_ERROR_INVALID_PARAMETER More than one buffer
+ * @retval TIZEN_ERROR_INVALID_PARAMETER The pointer was NULL
* @retval Other An arbitrary Tizen error code
*/
int dlogutil_buffer_get_size(dlogutil_buffer_e buffer, unsigned int *size);
* @param[out] type The default timestamp type of the passed buffer
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER Invalid buffer
+ * @retval TIZEN_ERROR_INVALID_PARAMETER More than one buffer
+ * @retval TIZEN_ERROR_INVALID_PARAMETER The pointer was NULL
* @retval Other An arbitrary Tizen error code
*/
int dlogutil_buffer_get_default_ts_type(dlogutil_buffer_e buffer, dlogutil_sorting_order_e *type);
* @param[out] available Whether the given timestamp type is guaranteed to be available
* @return An error code
* @retval TIZEN_ERROR_NONE Success
- * @retval TIZEN_INVALID_PARAMETER Invalid parameter
+ * @retval TIZEN_ERROR_INVALID_PARAMETER Invalid buffer
+ * @retval TIZEN_ERROR_INVALID_PARAMETER More than one buffer
+ * @retval TIZEN_ERROR_INVALID_PARAMETER The pointer was NULL
*/
int dlogutil_buffer_check_ts_type_available(dlogutil_buffer_e buffer, dlogutil_sorting_order_e type, bool *available);
#include <logretrieve.h>
#include <privilege.h>
#include <tizen.h>
+#include <logcommon.h>
EXPORT_API int dlogutil_entry_get_tid(const dlogutil_entry_s *e, pid_t *tid)
{
- assert(e);
- assert(tid);
+ CHECK_PARAM(e);
+ CHECK_PARAM(tid);
*tid = e->tid;
if (e->tid == 0)
EXPORT_API int dlogutil_entry_get_pid(const dlogutil_entry_s *e, pid_t *pid)
{
- assert(e);
- assert(pid);
+ CHECK_PARAM(e);
+ CHECK_PARAM(pid);
*pid = e->pid;
if (e->pid == 0)
EXPORT_API int dlogutil_entry_get_priority(const dlogutil_entry_s *e, log_priority *prio)
{
- assert(e);
- assert(prio);
+ CHECK_PARAM(e);
+ CHECK_PARAM(prio);
*prio = e->priority;
return TIZEN_ERROR_NONE;
EXPORT_API int dlogutil_sorting_options_disable_sorting(dlogutil_sorting_options_s *sorting)
{
- assert(sorting);
+ CHECK_PARAM(sorting);
sorting->logs_size = 0;
return TIZEN_ERROR_NONE;
EXPORT_API int dlogutil_sorting_options_enable_sorting(dlogutil_sorting_options_s *sorting)
{
- assert(sorting);
+ CHECK_PARAM(sorting);
if (sorting->logs_size == 0)
sorting->logs_size = DEFAULT_SORT_BUFFER_SIZE;
EXPORT_API int dlogutil_sorting_options_enable_sorting_with_size(dlogutil_sorting_options_s *sorting, unsigned int entry_count)
{
- assert(sorting);
- assert(entry_count > 0);
+ CHECK_PARAM(sorting);
+ CHECK_PARAM(entry_count > 0);
sorting->logs_size = entry_count;
return TIZEN_ERROR_NONE;
EXPORT_API int dlogutil_sorting_options_set_sort_by(dlogutil_sorting_options_s *sorting, dlogutil_sorting_order_e sort_by)
{
- assert(sorting);
+ CHECK_PARAM(sorting);
sorting->sort_by = sort_by;
return TIZEN_ERROR_NONE;
static int dlogutil_get_logs_internal(int buffers, unsigned int mode, dlogutil_entry_cb callback, void *data,
dlogutil_sorting_options_s *sorting, dlogutil_filter_options_s *filter)
{
- assert(callback);
+ CHECK_PARAM(callback);
/* KMSG lacks some timestamps so we have trouble sorting
* it with core buffers, thus mixing them is not supported
EXPORT_API int dlogutil_buffer_get_name(dlogutil_buffer_e buffer, const char **name)
{
+ CHECK_PARAM(name);
+
COMMON_INIT_SINGLE
*name = fdi_ptrs[0]->name;
EXPORT_API int dlogutil_buffer_get_size(dlogutil_buffer_e buffer, unsigned int *size)
{
+ CHECK_PARAM(size);
+
COMMON_INIT_SINGLE
return fdi_ptrs[0]->ops->getsize(fdi_ptrs[0], size);
EXPORT_API int dlogutil_buffer_get_default_ts_type(dlogutil_buffer_e buffer, dlogutil_sorting_order_e *type)
{
+ CHECK_PARAM(type);
+
COMMON_INIT_SINGLE
*type = get_proper_sort_by(DLOGUTIL_SORT_DEFAULT, is_pipe, &conf, &(bool){ false });
EXPORT_API int dlogutil_buffer_check_ts_type_available(dlogutil_buffer_e buffer, dlogutil_sorting_order_e type, bool *available)
{
+ CHECK_PARAM(available);
+
COMMON_INIT_SINGLE
switch (type) {
#include <tizen.h>
#include <logprint.h>
+#include <logcommon.h>
/**
* @addtogroup SHARED_FUNCTIONS
* @param[in] filterExpression A filter expression ("tag:prio")
* @return An error code
* @retval TIZEN_ERROR_NONE Success
- * @retval TIZEN_ERROR_INVALID_PARAMETER One of the arguments was invalid
+ * @retval TIZEN_ERROR_INVALID_PARAMETER Invalid syntax of the filterspec
* @retval TIZEN_ERROR_OUT_OF_MEMORY Couldn't allocate enough memory
* @remarks Assumes single threaded execution
*/
* @param[in] filterString A filter string containing multiple filter rules delimited by spaces, tabs or commas
* @return An error code
* @retval TIZEN_ERROR_NONE Success
- * @retval TIZEN_ERROR_INVALID_PARAMETER One of the arguments was invalid
+ * @retval TIZEN_ERROR_INVALID_PARAMETER Invalid syntax of the filterspec
+ * @retval TIZEN_ERROR_INVALID_PARAMETER One of the pointers was NULL
* @retval TIZEN_ERROR_OUT_OF_MEMORY Couldn't allocate enough memory
* @remarks Assumes single threaded execution
*/
LIBDLOGUTIL_EXPORT_API int dlogutil_filter_options_set_filterspec(dlogutil_filter_options_s *p_filter,
const char *filterString)
{
- assert(p_filter);
- assert(filterString);
+ CHECK_PARAM(p_filter);
+ CHECK_PARAM(filterString);
char *filterStringCopy = strdup(filterString);
if (!filterStringCopy)
* @param[in] pid A pid to filter by
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER One of the pointers was NULL
* @retval TIZEN_ERROR_OUT_OF_MEMORY Couldn't allocate enough memory
* @remarks Assumes single threaded execution
*/
LIBDLOGUTIL_EXPORT_API int dlogutil_filter_options_set_pid(dlogutil_filter_options_s *p_filter, pid_t pid)
{
- assert(p_filter);
+ CHECK_PARAM(p_filter);
FilterInfo *p_fi = filterinfo_new(NULL, 0, false, false, pid, FILTERINFO_TID_NONE);
if (!p_fi)
* @param[in] tid A tid to filter by
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER One of the pointers was NULL
* @retval TIZEN_ERROR_OUT_OF_MEMORY Couldn't allocate enough memory
* @remarks Assumes single threaded execution
*/
LIBDLOGUTIL_EXPORT_API int dlogutil_filter_options_set_tid(dlogutil_filter_options_s *p_filter, pid_t tid)
{
- assert(p_filter);
+ CHECK_PARAM(p_filter);
FilterInfo *p_fi = filterinfo_new(NULL, 0, false, false, FILTERINFO_PID_NONE, tid);
if (!p_fi)
* @param[out] tag The log tag
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER One of the pointers was NULL
* @retval TIZEN_ERROR_NO_DATA No valid tag was found
*/
LIBDLOGUTIL_EXPORT_API int dlogutil_entry_get_tag(const dlogutil_entry_s *entry, const char **tag)
{
- assert(entry);
- assert(tag);
+ CHECK_PARAM(entry);
+ CHECK_PARAM(tag);
if (entry->len - (int) sizeof(dlogutil_entry_s) < 2
|| ((const char *)entry)[entry->len - 1] != '\0') {
* @param[out] msg The log message
* @return An error code
* @retval TIZEN_ERROR_NONE Success
+ * @retval TIZEN_ERROR_INVALID_PARAMETER One of the pointers was NULL
* @retval TIZEN_ERROR_NO_DATA No valid message was found
*/
LIBDLOGUTIL_EXPORT_API int dlogutil_entry_get_message(const dlogutil_entry_s *entry, const char **msg)
{
- assert(entry);
- assert(msg);
+ CHECK_PARAM(entry);
+ CHECK_PARAM(msg);
if (entry->len - (int) sizeof(dlogutil_entry_s) < 2
|| ((const char *)entry)[entry->len - 1] != '\0') {