Skip to main content

Logger Module

Overview

The Logger module is designed to produce logs for applications with flexible output options. It supports different log data formats and ensures structured logging for better observability.

Features

  • Supports multiple output destinations:
    • Stdout (default)
    • File (logs are stored in app.log)
    • Queue service (S3 storage via Kafka)
  • Supports various log data formats:
    • Space-separated key-value pairs: key:value key:value
    • Comma-separated key-value pairs: key:value, key:value
    • JSON or direct objects: {key:value, key:value}
    • Quoted JSON-like objects: '{key:value, key:value}'
  • Default log fields included:
    • Timestamp (ISO format)
    • Log level (INFO, WARN, DEBUG, ERROR)

Installation

pip install vtb_logger

Usage

Initializing the Logger

from vtb_logger import Logger

logger = Logger(service_id="my_system:my_service", log_type="file")
  • service_id: Required when using que log type (Format: <system-name>:<service-name>)
  • log_type: Options are stdout (default), file, or que

Logging Messages

logger.info(data="key1:value1 key2:value2")  # Space-separated
logger.warn(data="key1:value1, key2:value2") # Comma-separated
logger.debug(data='{"key1":"value1", "key2":"value2"}')  # JSON
logger.error(data={"key1": "value1", "key2": "value2"})  # Direct object

Required Environment Variables

For queue-based logging, set the following:

export BOOTSTRAP_SERVER=<kafka_queue_connection>

Implementation Details

  • __detect_data_format(data): Identifies the log data format
  • __log_formatter(level, data): Formats logs according to the identified data structure
  • __log_controller(log): Routes logs to the appropriate destination (stdout, file, or que)

License

This module is provided under the MIT License.


For more details, refer to the official documentation or contact support.

Metadata

Release files for vtb-logger 2.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vtb-logger 2.6.0
File Size Uploaded
vtb_logger-2.6.0.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vtb-logger 2.6.0
File Interpreter ABI Platform
vtb_logger-2.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.1 kB

Release files / vtb_logger-2.6.0.tar.gz

Download URL vtb_logger-2.6.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
482ec08489bc218c08d8e43d779c31f8077187e9bd31a52424bbc067f804900e
BLAKE2b-256 checksum
How to use checksums
e6c302d93ff871c72c5e5b0a514ea7dcc4f9ad8543544cf0193f70cce1cf52c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / vtb_logger-2.6.0-py3-none-any.whl

Download URL vtb_logger-2.6.0-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a96da43e475809df4b097582e49fda51805fdb5bfc0ffcff13946bd38a0734c
BLAKE2b-256 checksum
How to use checksums
2810ccfbde78dac32d10c0f84d2a7e069a80b15406c034bf70332c51342186c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

2.6.0 This release

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page