Skip to main content

provides a standardised, easy to import and use logging method with mcap

Project description

MCAP Logger 🧢

PyPI - Version pre-commit.ci status pytest uv Ruff gitmoji

Project description

This python package to provide a standardised, easy to import and use logging method.

The package is...

  • a logger module that leverages the existing MCAP and Foxglove packages
  • provides a plugin for standard Python loging

Links:

Example usage

Installing the library

pip install mcap-logger

Creating a simple log

import logging
from pathlib import Path

from mcap_logger.mcap_handler import McapHandler


def main():  # noqa: ANN201
    log_file = Path("hello.mcap")

    mcap_handler = McapHandler(log_file)
    mcap_handler.setLevel("DEBUG")

    logger = logging.getLogger("mcap_logger")
    logger.addHandler(mcap_handler)
    logger.setLevel("DEBUG")

    logger.info("Hello from mcap-logger-tutorial!")

Log Protobuf data

ℹ️ Protocol buffers are Google's language-neutral mechanism for serializing structured data. More info about it and its syntax: Protocol Buffers

from sensor_data_pb2 import SensorData
from mcap_logger.topic_logger import TopicLogger

log_file = Path("hello.mcap")
mcap_handler = McapHandler(log_file)
mcap_handler.setLevel("DEBUG")

logger = logging.getLogger("mcap_logger")
logger.addHandler(mcap_handler)
logger.setLevel("DEBUG")

# Log Protobuf data
sensor_message = SensorData(temperature=25, humidity=65)
TopicLogger("mcap_logger").topic("/sensor_data").write(sensor_message)

Call for Contributions

The MCAP-Logger project welcomes your expertise and enthusiasm!

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

mcap_logger-1.0.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

mcap_logger-1.0.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file mcap_logger-1.0.0.tar.gz.

File metadata

  • Download URL: mcap_logger-1.0.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for mcap_logger-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4b87c78b55d4ccebcce3e33441410af2688cd66a0a448d645ab5d9f5c64822c0
MD5 7685731a36b472022d5b423fb153a94a
BLAKE2b-256 a5d17880dc63390096d3e4eced8e7a7a5be0ec9810b69005ad863ec9eeea151f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcap_logger-1.0.0.tar.gz:

Publisher: release.yml on 8-bit-hunters/mcap_logger

Attestations:

File details

Details for the file mcap_logger-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mcap_logger-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for mcap_logger-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d8f11315e51a187b1daf6aa33ae57c7dbe157fa1c7e64432e81e25759279869
MD5 17878b97876a69f7c827ebe5e79bfad7
BLAKE2b-256 ed9eb5c4f078057d7eca7c98683553e7c485bd5ff618684e2674ad02be89426c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcap_logger-1.0.0-py3-none-any.whl:

Publisher: release.yml on 8-bit-hunters/mcap_logger

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page