No project description provided
Project description
Memfault Compact Log Library
This library enables decoding Memfault-flavored compact logs. For background information on compact logs, see here:
Usage
Some brief usage information below. See the source for detailed usage.
Extracting compact log format strings from .elf
To extract the format strings from the symbol file:
from mflt_compact_log.log_fmt import LogFormatElfSectionParser
elf = "path to elf file"
# parse the elf file
mappings = LogFormatElfSectionParser.get_mapping_from_elf_file(elf)
# 'mappings' is a dictionary mapping log id to LogFormatInfo data
print(mappings)
>>> {8: LogFormatInfo(filename='./main/console_example_main.c', line=245, n_args=0, fmt='This is a compact log example')}
Decoding compact logs
To apply the format string to raw compact log data:
from mflt_compact_log import CompactLogDecoder
# example format string; this could instead be retrieved from the elf file
fmt = "An Integer Format String: %d"
# compact log hex encoded raw data
compact_log = "820A0B"
# decode the log!
compact_log_as_bytes = bytes.fromhex(compact_log)
log = CompactLogDecoder.from_cbor_array(fmt, compact_log_as_bytes)
log.decode()
>>> 'An Integer Format String: 11'
Changes
[0.1.1] - 2024-11-14
- Fix some missing dependencies that are required as of the
0.1.0
release.
[0.1.0] - 2024-11-08
- Replace the wasmer-based decoder with a pure Python implementation
[0.0.5] - 2024-08-29
- Improve the output of
mflt-compact-log.log_fmt
for log format strings containing non-printable characters
[0.0.4] - 2024-06-13
- Source pyelftools from https://pypi.org/project/pyelftools/ again, as the required bugfixes have been merged upstream. See notes of 0.0.3 below.
[0.0.3] - 2024-01-30
- Source pyelftools from https://github.com/memfault/pyelftools while we are waiting for 2 bugfixes to get merged upstream (https://github.com/eliben/pyelftools/pull/537 and https://github.com/eliben/pyelftools/pull/538).
0.0.2
- support Python 3.9 and 3.10
- update
prettytable
dependency from0.7.2
to3.4.1
- update
pyelftools
dependency from^0.28.0
to^0.29.0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mflt_compact_log-0.1.1.tar.gz
(13.8 kB
view details)
Built Distribution
File details
Details for the file mflt_compact_log-0.1.1.tar.gz
.
File metadata
- Download URL: mflt_compact_log-0.1.1.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
17f311e13ca4da1d1a6df2e0399f7729cdfaeeb1806b1c67dd76d93c710d0674
|
|
MD5 |
6e0a7931525d1853b06b32d0ebd15e8e
|
|
BLAKE2b-256 |
b48b17ac59b2bf15fed1f2875849e6948514ff606ebb855739cdbbdb3d40224f
|
File details
Details for the file mflt_compact_log-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: mflt_compact_log-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
b9481dc9510d04836ff33913c924a8e035466c0601b481cfafe90844bb62eb1b
|
|
MD5 |
27e52d60f4e00863b8e07a9146b013da
|
|
BLAKE2b-256 |
55fbe66a64681c7380b009847d34899e10376d488425c03680ba4df474e5443b
|