https://github.com/mvinyard/abcparse
A better base class that handles parsing local arguments.
https://github.com/mvinyard/abcparse
baseclass parsing python
Last synced: 12 days ago
JSON representation
A better base class that handles parsing local arguments.
- Host: GitHub
- URL: https://github.com/mvinyard/abcparse
- Owner: mvinyard
- License: agpl-3.0
- Created: 2023-04-07T02:16:00.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-05T03:50:08.000Z (about 2 years ago)
- Last Synced: 2025-02-28T08:26:12.091Z (over 1 year ago)
- Topics: baseclass, parsing, python
- Language: JavaScript
- Homepage:
- Size: 405 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ABCParse

[](https://pypi.python.org/pypi/ABCParse/)
[](https://badge.fury.io/py/ABCParse)
[](https://github.com/psf/black)
A better base class that handles parsing local arguments.
```bash
pip install ABCParse
```
```python
from ABCParse import ABCParse
class SomeClass(ABCParse):
def __init__(self, arg1, arg2):
self.__parse__(kwargs=locals())
something = SomeClass(arg1 = 4, arg2 = "name")
```
## Logging
ABCParse includes a built-in logging system that provides visibility into the parsing process. You can configure the logging level, format, and output destination.
### Basic Usage
```python
from ABCParse import set_global_log_level, get_logger
# Set the global log level
set_global_log_level("debug") # Options: debug, info, warning, error, critical
# Get a custom logger for your module
logger = get_logger(name="my_module")
logger.info("This is an info message")
logger.debug("This is a debug message")
```
### Advanced Configuration
```python
from ABCParse import get_logger
# Configure a logger with custom settings
logger = get_logger(
name="my_custom_logger",
level="debug",
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
date_format="%Y-%m-%d %H:%M:%S",
file_path="logs/my_app.log", # Optional: log to file
propagate=False
)
# Log messages at different levels
logger.debug("Detailed information for debugging")
logger.info("General information about program execution")
logger.warning("Warning about potential issues")
logger.error("Error that occurred during execution")
logger.critical("Critical error that may cause program failure")
# Log dictionary data
config = {"param1": 42, "param2": "value", "enabled": True}
logger.log_dict(config, level="debug", prefix="Configuration")
```