Skip to main content

A logging package for Python applications

Project description

My Logging Package

A simple logging package for Python applications.

Installation

You can install the package using pip:

pip install git+https://github.com/yourusername/my_logging_package.git


# Changelog

## [0.6] - 2024-08-13
### Added
- get_current_version function to read the version number from setup.py.
- get_latest_pypi_version function to fetch the latest version of the package from PyPI.
- compare_versions function to compare the current version with the latest PyPI version.
- main function to orchestrate the version check.
- Test cases for get_current_version, get_latest_pypi_version, compare_versions, and the main execution block.
- Test case using subprocess to ensure the if __name__ == "__main__": main() block is executed and covers the script entry point.

### Changed
- Refactored workflow_scripts/check_versions.py to include the main execution logic in the main function for better testability.

### Fixed
- Ensured tests do not depend on the actual contents of setup.py by mocking the version number.

## [0.5] - 2024-08-13
### Added
- Support for structured logging (JSON-formatted logs) to improve log readability and facilitate log parsing by log management systems like ELK stack or Splunk.
- JSONFormatter class to format log records as JSON.
- json_format parameter in setup_logger function to enable JSON formatting.
- Unit tests to validate JSON formatted logs and ensure they include all required fields.
- Test cases for JSON formatted logs to check for correct fields and content.

### Changed
- setup_logger function updated to accept json_format parameter for structured logging.

## [0.4] - 2024-08-07
### Added
- Configuration for Black code formatter to align with Flake8 linting styles.
- Black's `pyproject.toml` configuration file with a line length of 79 characters to match Flake8.
- Flake8's `.flake8` configuration file updated to ignore `E203` and `W503` for compatibility with Black.
- Option to enable console logging in addition to file logging in the `setup_logger` function.
- Error handling to ensure at least one logging option (file or console) is enabled.
- Sad path tests to handle invalid log levels, invalid log file paths, and missing parameters.

### Changed
- Default line length changed from 88 to 79 characters to maintain consistency with Flake8.
- `setup_logger` function updated to raise an error if both `log_file` and `console` are not provided.
- Updated test cases to include validations for new error handling.

### Fixed
- Handled `None` values in `set_logging_level` function to avoid `AttributeError`.
- Corrected the expected exception in the `test_invalid_log_file_permission` test case from `PermissionError` to `FileNotFoundError`.

## [0.3] - 2024-08-07
### Added
- `set_logging_level` function to map string level names to logging constants.
- Ability to set logging levels dynamically based on string input (e.g., "DEBUG", "INFO").
- Parametrized tests to verify logging levels and ensure correct behavior for different levels.

### Changed
- Updated `setup_logger` function to accept logging level as a parameter.

## [0.2] - 2024-08-07
### Added
- Initial setup of the logging package with `setup_logger` function.
- Basic logging configuration with file handler and formatter.
- Unit tests to verify basic logging functionality.

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

kom_python_logging-0.6.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

kom_python_logging-0.6-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file kom_python_logging-0.6.tar.gz.

File metadata

  • Download URL: kom_python_logging-0.6.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for kom_python_logging-0.6.tar.gz
Algorithm Hash digest
SHA256 6ebe7c241b8ae53f851ac708c52552bc5719d4ee49104b5d5e7af866620d6f14
MD5 9147858b18732a81f54ee23ce85c653a
BLAKE2b-256 964650014030abc9b9864dd298fee7d5f8789a867a0f97d9ec2e0988b5b279f4

See more details on using hashes here.

File details

Details for the file kom_python_logging-0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for kom_python_logging-0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d0ce91beea7a210dca230b738a6ca7801a0b4dca3e67e317e042f0d5eea0b298
MD5 66ccbd198a354e308befbced9d19b90d
BLAKE2b-256 99147f7f1838e5bfb016df2cbbaa77d203af30b3ff1834a6909fbce2fbf408e3

See more details on using hashes here.

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