dlog
Logging framework
Loading...
Searching...
No Matches
dlogutil.h
Go to the documentation of this file.
1/* MIT License
2 *
3 * Copyright (c) 2012-2020 Samsung Electronics Co., Ltd.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is furnished
10 * to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE. */
22
23#ifndef __TIZEN_SYSTEM_DLOGUTIL_H__
24#define __TIZEN_SYSTEM_DLOGUTIL_H__
25
26#include <time.h>
27#include <tizen_type.h>
28#include <dlog.h>
29#include <limits.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
39
55
62typedef struct dlogutil_entry dlogutil_entry_s;
63
71
85int dlogutil_entry_get_tid(const dlogutil_entry_s *entry, pid_t *tid);
86
100int dlogutil_entry_get_pid(const dlogutil_entry_s *entry, pid_t *pid);
101
118int dlogutil_entry_get_tag(const dlogutil_entry_s *entry, const char **tag);
119
134int dlogutil_entry_get_message(const dlogutil_entry_s *entry, const char **msg);
135
152int dlogutil_entry_get_timestamp(const dlogutil_entry_s *entry, dlogutil_sorting_order_e order, struct timespec *ts);
153
167
173typedef struct dlogutil_config dlogutil_config_s;
174
184
193
206
219
233
249
263
279int dlogutil_config_sorting_enable_with_size(dlogutil_config_s *config, unsigned int entry_count);
280
296
309
316#define DLOGUTIL_MAX_DUMP_SIZE UINT_MAX
317
324typedef struct dlogutil_state dlogutil_state_s;
325
334
349
364
381int dlogutil_config_mode_set_dump(dlogutil_config_s *config, unsigned int entry_count);
382
398int dlogutil_config_mode_set_compressed_memory_dump(dlogutil_config_s *config, const char *compression_buffer);
399
400
421
444int dlogutil_get_log(dlogutil_state_s *state, int timeout, dlogutil_entry_s **entry_out);
445
462int dlogutil_buffer_clear(dlogutil_state_s *state, log_id_t buffer);
463
476int dlogutil_buffer_get_name(log_id_t buffer, const char **name);
477
500int dlogutil_buffer_get_capacity(dlogutil_state_s *state, log_id_t buffer, unsigned int *capacity);
501
524int dlogutil_buffer_get_usage(dlogutil_state_s *state, log_id_t buffer, unsigned int *usage);
525
546
567int dlogutil_buffer_check_ts_type_available(log_id_t buffer, dlogutil_sorting_order_e type, bool *available);
568
588int dlogutil_buffer_get_alias(dlogutil_state_s *state, log_id_t buffer, log_id_t *real_buffer);
589
593
594#ifdef __cplusplus
595}
596#endif
597
598#endif /* __TIZEN_SYSTEM_DLOGUTIL_H__ */
This file is the header file of the interface of Dlog.
log_priority
Enumeration for log priority values in ascending priority order.
Definition dlog.h:95
int dlogutil_config_order_set(dlogutil_config_s *config, dlogutil_sorting_order_e sort_by)
Chooses a timestamp type by which returned logs are sorted by @since_tizen 6.0.
int dlogutil_entry_get_priority(const dlogutil_entry_s *entry, log_priority *prio)
Retrieves the priority level metadata of the log entry.
int dlogutil_config_filter_filterspec(dlogutil_config_s *config, const char *query)
Enables retrieving only those logs that match a given filter.
int dlogutil_buffer_get_default_ts_type(log_id_t buffer, dlogutil_sorting_order_e *type)
Gets the default sorting timestamp type of a buffer. @since_tizen 6.0.
struct dlogutil_state dlogutil_state_s
A struct containing the state of a log handling request.
Definition dlogutil.h:324
int dlogutil_buffer_check_ts_type_available(log_id_t buffer, dlogutil_sorting_order_e type, bool *available)
Checks if a buffer contains timestamps of a given type. @since_tizen 6.0.
void dlogutil_config_destroy(dlogutil_config_s *config)
Destroys the dlogutil_config_s struct and cleans up its memory.
int dlogutil_config_mode_set_monitor(dlogutil_config_s *config)
Set log retrieval mode to retrieving all the logs since the call without an end.
int dlogutil_buffer_get_name(log_id_t buffer, const char **name)
Gets the human-readable, constant name of a buffer.
int dlogutil_buffer_clear(dlogutil_state_s *state, log_id_t buffer)
Irreversibly clears a log buffer from any logs inside.
dlogutil_config_s * dlogutil_config_create(void)
Creates a new dlogutil_config_s struct to be filled with configuration.
int dlogutil_entry_get_pid(const dlogutil_entry_s *entry, pid_t *pid)
Retrieves the PID (process identificator) of the log sender.
int dlogutil_config_buffer_add(dlogutil_config_s *config, log_id_t buf)
Adds a buffer whence logs will be taken to a request.
int dlogutil_config_sorting_enable_with_size(dlogutil_config_s *config, unsigned int entry_count)
Enables sorting, choosing the sort buffer size manually. @since_tizen 6.0.
int dlogutil_entry_get_message(const dlogutil_entry_s *entry, const char **msg)
Retrieves the message (without any metadata) of the log entry.
int dlogutil_config_mode_set_compressed_memory_dump(dlogutil_config_s *config, const char *compression_buffer)
Set log retrieval mode to dumping compressed historical logs.
dlogutil_sorting_order_e
Enumeration for timestamp-based log sorting orderings.
Definition dlogutil.h:47
void dlogutil_entry_destroy(dlogutil_entry_s *entry)
Destroys the dlogutil_entry_s struct and cleans up its memory. @since_tizen 9.0.
int dlogutil_get_log(dlogutil_state_s *state, int timeout, dlogutil_entry_s **entry_out)
Retrieves a single log according to a dump request.
int dlogutil_config_sorting_enable(dlogutil_config_s *config)
Enables log sorting for given log retrieval request. @since_tizen 6.0.
int dlogutil_buffer_get_capacity(dlogutil_state_s *state, log_id_t buffer, unsigned int *capacity)
Gets the data storage capacity of a log buffer in bytes.
int dlogutil_buffer_get_alias(dlogutil_state_s *state, log_id_t buffer, log_id_t *real_buffer)
Gets the buffer aliasing (same storage) information @since_tizen 6.0.
struct dlogutil_config dlogutil_config_s
A struct containing libdlogutil initialisation configuration.
Definition dlogutil.h:173
int dlogutil_config_sorting_disable(dlogutil_config_s *config)
Disables log sorting for given log retrieval request.
int dlogutil_entry_get_tid(const dlogutil_entry_s *entry, pid_t *tid)
Retrieves the TID (thread identificator) of the log sender.
int dlogutil_config_filter_tid(dlogutil_config_s *config, pid_t tid)
Enables retrieving only those logs that are logged by the thread with the given TID.
int dlogutil_config_mode_set_continuous(dlogutil_config_s *config)
Set log retrieval mode to retrieving all the logs since the start of the system without an end.
struct dlogutil_entry dlogutil_entry_s
A struct containing the metadata and contents for a single dlog entry.
Definition dlogutil.h:62
int dlogutil_entry_get_timestamp(const dlogutil_entry_s *entry, dlogutil_sorting_order_e order, struct timespec *ts)
Retrieves the timestamp of given type from the log entry.
int dlogutil_config_connect(dlogutil_config_s *config, dlogutil_state_s **state_out)
Finalizes the config into a state struct by connecting to buffers.
int dlogutil_config_filter_pid(dlogutil_config_s *config, pid_t pid)
Enables retrieving only those logs that are logged by the process with the given PID.
int dlogutil_entry_get_tag(const dlogutil_entry_s *entry, const char **tag)
Retrieves the tag (arbitrary label) of the log entry.
int dlogutil_config_mode_set_dump(dlogutil_config_s *config, unsigned int entry_count)
Set log retrieval mode to dumping all the logs since the start of the system until the call (possibly...
int dlogutil_buffer_get_usage(dlogutil_state_s *state, log_id_t buffer, unsigned int *usage)
Gets the storage data usage of a log buffer, in bytes.
void dlogutil_state_destroy(dlogutil_state_s *state)
Destroys the dlogutil_state_s struct and frees its memory.
@ DLOGUTIL_SORT_RECV_REAL
Definition dlogutil.h:51
@ DLOGUTIL_SORT_DEFAULT
Definition dlogutil.h:52
@ DLOGUTIL_SORT_SENT_MONO
Definition dlogutil.h:48
@ DLOGUTIL_SORT_SENT_REAL
Definition dlogutil.h:49
@ DLOGUTIL_SORT_RECV_MONO
Definition dlogutil.h:50