libsf3
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
sf3_log.h File Reference
#include "sf3_core.h"
Include dependency graph for sf3_log.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sf3_log_entry
 
struct  sf3_log_chunk
 A chunk of log entries in a log file. More...
 
struct  sf3_log
 

Macros

#define SF3_FORMAT_ID_LOG   0x04
 The format_id for a log file.
 

Functions

SF3_INLINE const char * sf3_log_entry_source (const struct sf3_log_entry *entry)
 Returns the string of the "source" for the entry.
 
SF3_INLINE const char * sf3_log_entry_category (const struct sf3_log_entry *entry)
 Returns the string of the "category" for the entry.
 
SF3_INLINE const char * sf3_log_entry_message (const struct sf3_log_entry *entry)
 Returns the string of the message for the entry.
 
SF3_INLINE const struct sf3_log_entrysf3_log_next_entry (const struct sf3_log_entry *entry)
 
SF3_INLINE const struct sf3_log_entrysf3_log_first_entry (const struct sf3_log_chunk *chunk)
 Returns the first entry of the chunk.
 
SF3_INLINE const struct sf3_log_entrysf3_log_entry (const struct sf3_log_chunk *chunk, uint32_t entry)
 
SF3_INLINE const struct sf3_log_chunksf3_log_next_chunk (const struct sf3_log_chunk *chunk)
 
SF3_INLINE uint32_t sf3_log_chunk_capacity (const struct sf3_log_chunk *chunk)
 Returns the number of log entries that can be stored in the chunk.
 
SF3_INLINE uint32_t sf3_log_chunk_remaining (const struct sf3_log_chunk *chunk)
 
SF3_EXPORT size_t sf3_log_size (const struct sf3_log *log)
 Computes the size of the log file in bytes.
 

Macro Definition Documentation

◆ SF3_FORMAT_ID_LOG

#define SF3_FORMAT_ID_LOG   0x04

The format_id for a log file.

Definition at line 6 of file sf3_log.h.

Function Documentation

◆ sf3_log_chunk_capacity()

SF3_INLINE uint32_t sf3_log_chunk_capacity ( const struct sf3_log_chunk chunk)

Returns the number of log entries that can be stored in the chunk.

Definition at line 90 of file sf3_log.h.

◆ sf3_log_chunk_remaining()

SF3_INLINE uint32_t sf3_log_chunk_remaining ( const struct sf3_log_chunk chunk)

Returns the number of log entries that can still be added to the chunk before it runs out of capacity.

Definition at line 98 of file sf3_log.h.

◆ sf3_log_entry()

SF3_INLINE const struct sf3_log_entry * sf3_log_entry ( const struct sf3_log_chunk chunk,
uint32_t  entry 
)

Returns the log entry at the requested index. If the entry index is out of bounds for the chunk, null is returned instead.

Definition at line 76 of file sf3_log.h.

◆ sf3_log_entry_category()

SF3_INLINE const char * sf3_log_entry_category ( const struct sf3_log_entry entry)

Returns the string of the "category" for the entry.

Definition at line 51 of file sf3_log.h.

◆ sf3_log_entry_message()

SF3_INLINE const char * sf3_log_entry_message ( const struct sf3_log_entry entry)

Returns the string of the message for the entry.

Definition at line 56 of file sf3_log.h.

◆ sf3_log_entry_source()

SF3_INLINE const char * sf3_log_entry_source ( const struct sf3_log_entry entry)

Returns the string of the "source" for the entry.

Definition at line 46 of file sf3_log.h.

◆ sf3_log_first_entry()

SF3_INLINE const struct sf3_log_entry * sf3_log_first_entry ( const struct sf3_log_chunk chunk)

Returns the first entry of the chunk.

Definition at line 69 of file sf3_log.h.

◆ sf3_log_next_chunk()

SF3_INLINE const struct sf3_log_chunk * sf3_log_next_chunk ( const struct sf3_log_chunk chunk)

Returns the next chunk after this one. Note that this function does not perform any bounds checking whatsoever. It is up to you to ensure you do not call this with the last chunk of a log.

Definition at line 85 of file sf3_log.h.

◆ sf3_log_next_entry()

SF3_INLINE const struct sf3_log_entry * sf3_log_next_entry ( const struct sf3_log_entry entry)

Returns the next entry after this one. Note that this function does not perform any bounds checking whatsoever. It is up to you to ensure you do not call this with the last entry of a chunk.

Definition at line 64 of file sf3_log.h.

◆ sf3_log_size()

SF3_EXPORT size_t sf3_log_size ( const struct sf3_log log)

Computes the size of the log file in bytes.

Definition at line 103 of file sf3_log.h.