pub struct DlogutilState { /* private fields */ }Expand description
A struct containing the state of a log handling request.
Implementations§
Source§impl DlogutilState
impl DlogutilState
Sourcepub fn create(config: DlogutilConfig) -> Result<Self>
pub fn create(config: DlogutilConfig) -> Result<Self>
Finalizes the config into a state struct by connecting to buffers.
An application having platform privilege level can read platform log data by declaring http://tizen.org/privilege/log.
§Returns
Ok(Self)- A handle to the state struct.Err(std::io::Error)- An error.
§Errors
std::io::ErrorKind::InvalidInput- One of the pointers was NULL.std::io::ErrorKind::InvalidInput- No buffers selected.std::io::ErrorKind::Uncategorized- Unsupported buffer set (KMSG + non-KMSG).std::io::ErrorKind::Uncategorized- Unsupported backend (zero-copy).std::io::ErrorKind::Uncategorized- No buffers were opened (incl. due to null backend).std::io::ErrorKind::Uncategorized- Couldn’t read config file.std::io::ErrorKind::Uncategorized- Couldn’t contact log backend.std::io::ErrorKind::OutOfMemory- There’s not enough memory.
Sourcepub fn get_log(&mut self, timeout: Option<Duration>) -> Result<DlogutilEntry>
pub fn get_log(&mut self, timeout: Option<Duration>) -> Result<DlogutilEntry>
Retrieves a single log according to a dump request.
Returns a returned log as a DlogutilEntry struct.
If the calling process doesn’t have CAP_SYSLOG and is not in the
log group, you will only get some of the logs.
Also, you must set the mode (DlogutilConfig::mode_set_*).
§Arguments
timeout- How many miliseconds to wait for the log. The actual runtime of the call can obviously be slightly longer than this argument. 0 means don’t wait, None means wait indefinitely.
§Returns
Ok(DlogutilEntry)- A returned log.Err(std::io::Error)- An error.
§Errors
std::io::ErrorKind::Uncategorized- Timeout exceeded.std::io::ErrorKind::Uncategorized- In dump mode, no more logs remaining.std::io::ErrorKind::InvalidInput- One of the pointers was NULL.std::io::ErrorKind::InvalidInput- State not in log-getting mode.std::io::ErrorKind::OutOfMemory- There’s not enough memory.std::io::ErrorKind::Uncategorized- Couldn’t fulfill request.
Sourcepub fn buffer_clear(&mut self, buffer: BufferId) -> Result<()>
pub fn buffer_clear(&mut self, buffer: BufferId) -> Result<()>
Irreversibly clears a log buffer from any logs inside.
Either CAP_SYSLOG or being in the log group is required.
Also, you can’t use one of the log-getting modes
(DlogutilConfig::mode_set_*).
§Errors
std::io::ErrorKind::InvalidInput- One of the pointers was NULL.std::io::ErrorKind::Uncategorized- Couldn’t fulfill request.
Sourcepub fn buffer_get_capacity(&mut self, buffer: BufferId) -> Result<u32>
pub fn buffer_get_capacity(&mut self, buffer: BufferId) -> Result<u32>
Gets the data storage capacity of a log buffer in bytes.
Either CAP_SYSLOG or being in the log group is required.
Also, you can’t use one of the log-getting modes
(DlogutilConfig::mode_set_*).
§Returns
Ok(u32)- The buffer’s maximum capacity in bytes.Err(std::io::Error)- An error.
§Errors
std::io::ErrorKind::InvalidInput- State in log-getting mode.std::io::ErrorKind::InvalidInput- One of the pointers was NULL.std::io::ErrorKind::Uncategorized- Couldn’t fulfill request.
Sourcepub fn buffer_get_usage(&mut self, buffer: BufferId) -> Result<u32>
pub fn buffer_get_usage(&mut self, buffer: BufferId) -> Result<u32>
Gets the storage data usage of a log buffer in bytes.
Either CAP_SYSLOG or being in the log group is required.
Also, you can’t use one of the log-getting modes
(DlogutilConfig::mode_set_*).
§Returns
Ok(u32)- Buffer’s current usage in bytes.Err(std::io::Error)- An error.
§Errors
std::io::ErrorKind::InvalidInput- State in log-getting mode.std::io::ErrorKind::InvalidInput- One of the pointers was NULL.std::io::ErrorKind::Uncategorized- Couldn’t fulfill request.
Sourcepub fn buffer_get_alias(&self, buffer: BufferId) -> Result<BufferId>
pub fn buffer_get_alias(&self, buffer: BufferId) -> Result<BufferId>
Gets the buffer aliasing (same storage) information.
Sometimes, multiple buffers will be backed by a single log storage (for example, by the same kernel device). In such cases, the storage will only be opened once. This function allows you to see whether this is the case.
§Returns
Ok(BufferId)- Buffer aliasing information.Err(std::io::Error)- An error.
§Errors
std::io::ErrorKind::InvalidInput- One of the pointers was NULL.