BSB Developer Docs
Loading...
Searching...
No Matches
log_storage.h File Reference

Log capture service API. More...

#include <stdbool.h>

Go to the source code of this file.

Macros

#define RECORD_LOG_STORAGE   "log_storage"
 The string key for the LogStorage instance access.
 
#define LOG_STORAGE_DUMP_DEFAULT_FILE_PATH   "/ext/log.txt"
 Default file path used when log_storage_dump() is called with NULL.
 

Typedefs

typedef struct LogStorage LogStorage
 Opaque log storage instance.
 

Functions

bool log_storage_dump (LogStorage *instance, const char *path)
 Snapshot the captured log buffer into a file on the /ext partition.
 
void log_storage_suspend_remote (LogStorage *instance)
 Temporarily release the remote log UART.
 
void log_storage_resume_remote (LogStorage *instance)
 Resume remote log reception after log_storage_suspend_remote.
 

Detailed Description

Log capture service API.

Macro Definition Documentation

◆ RECORD_LOG_STORAGE

#define RECORD_LOG_STORAGE   "log_storage"

The string key for the LogStorage instance access.

Get the instance pointer by calling furi_record_open(RECORD_LOG_STORAGE).

Typedef Documentation

◆ LogStorage

typedef struct LogStorage LogStorage

Opaque log storage instance.

Obtain it via furi_record_open(RECORD_LOG_STORAGE).

Function Documentation

◆ log_storage_dump()

bool log_storage_dump ( LogStorage * instance,
const char * path )

Snapshot the captured log buffer into a file on the /ext partition.

The complete log lines held in the in-memory circular buffer are written to path. Partial lines are never emitted: a leading fragment left by the buffer wrap-around and a trailing in-progress line are both discarded, so the file contains only whole log lines.

Note
The in-memory buffer is left untouched and keeps accumulating logs after the call (the snapshot is a copy, not a move).
Parameters
[in]instancepointer to the LogStorage instance
[in]pathdestination file path, or NULL to use LOG_STORAGE_DUMP_DEFAULT_FILE_PATH
Returns
true if the file was written successfully, false otherwise

◆ log_storage_resume_remote()

void log_storage_resume_remote ( LogStorage * instance)

Resume remote log reception after log_storage_suspend_remote.

Restores reception only when all outstanding suspends have been resumed; otherwise the line remains released for its current owner.

Parameters
[in]instancepointer to the LogStorage instance

◆ log_storage_suspend_remote()

void log_storage_suspend_remote ( LogStorage * instance)

Temporarily release the remote log UART.

Releases the serial line used to receive remote logs so that another consumer can acquire it. Suspends are counted: the line is released on the first call and stays released until every suspend is matched by a log_storage_resume_remote call.

Parameters
[in]instancepointer to the LogStorage instance