provides a standardised, easy to import and use logging method with mcap
Project description
MCAP Logger 🧢
This python package wraps the MCap protobuf logging package with the Foxglove schemas to provide a standardised, easy to import and use logging method.
Usage
- Add the package to your python project.
- Import the package and use the
get_logger
function to create your logger.
from mcap_logger.mcap_logger import get_logger
logger = get_logger(__name__)
- If you haven't provided any log file path and or log level to the
get_logger
function, you can use environmental variables to specify them at run time.LOG_LEVEL
for log level, andLOG_ROOT
for the log file.
LOG_LEVEL=DEBUG LOG_ROOT=log_file.mcap uv run python -m mcap.demo.demo
- Use the MCAPLogger
.debug()
,.info()
,.warning()
, etc. functions to create different types of log messages - If you want to log topics like sensor data, you have to first specify the message with protobuf. (See the Working with ProtoBuf section).
- You can open the created log file with Foxglove Studio.
For an example see demo.py.
The output:
Working with ProtoBuf
Protocol buffers are Google's language-neutral mechanism for serializing structured data.
ℹ️ More info about it and its syntax: Protocol Buffers
- Make sure that you have the latest protobuf-compiler installed protoc installation
- You can compile the
.proto
file with the following command.
Example:
protoc --python_out=. sensor_data.proto
- Import the created protobuf python script (this can confuse your linter).
- Create a protobuf message and use the
.topic().write()
function to log the message.
Example:
from mcap_logger.demo.sensor_data_pb2 import SensorData
sensor_message = SensorData(temperature=25, humidity=65)
logger.topic("/sensor_data").write(sensor_message)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mcap_logger-0.1.17.tar.gz
.
File metadata
- Download URL: mcap_logger-0.1.17.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83f2d71a3a3079ad0d94d55db23235cc5c3b14ca0710c838eba1691523ababbc |
|
MD5 | b90acd5b86318e94033b51d2c2e124dd |
|
BLAKE2b-256 | b1b1cfdf9663b2f9bc93eef08443d72b53fee0671545bef8aaf532f049bfc90b |
Provenance
The following attestation bundles were made for mcap_logger-0.1.17.tar.gz
:
Publisher:
publishing.yml
on 8-bit-hunters/mcap_logger
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
mcap_logger-0.1.17.tar.gz
- Subject digest:
83f2d71a3a3079ad0d94d55db23235cc5c3b14ca0710c838eba1691523ababbc
- Sigstore transparency entry: 145976628
- Sigstore integration time:
- Predicate type:
File details
Details for the file mcap_logger-0.1.17-py3-none-any.whl
.
File metadata
- Download URL: mcap_logger-0.1.17-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 677909cf78634230d3dabd54ee781e3447f6c52fb154f0085546bee9434b4b41 |
|
MD5 | 543c204049ab39194da245dec4e78cbe |
|
BLAKE2b-256 | 346d3ff40bbc2a619ee5ceb4d4512fd2ccd61938ecb85fcdf8f9c506748bebfa |
Provenance
The following attestation bundles were made for mcap_logger-0.1.17-py3-none-any.whl
:
Publisher:
publishing.yml
on 8-bit-hunters/mcap_logger
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
mcap_logger-0.1.17-py3-none-any.whl
- Subject digest:
677909cf78634230d3dabd54ee781e3447f6c52fb154f0085546bee9434b4b41
- Sigstore transparency entry: 145976633
- Sigstore integration time:
- Predicate type: