Metadata-Version: 2.1
Name: kayer-pretty-logger
Version: 1.0.3
Summary: A pretty and colorful logger to emulate nest.js's logger
Home-page: https://github.com/PilotKayer/pretty_logger
Author: Kayer
Author-email: devkayer@gmail.com
Project-URL: Docs, https://github.com/PilotKayer/pretty_logger/blob/main/README.md
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# Pretty Logger
## Description
This is python package has been developed to emulate the nest.js integrated logger.
It allows for colorful terminal logs as well as activating or deactivating debug/warn or error print statements.
## Install
```
pip install pretty-logger
```

---

## In-code usage
To use it, create an instance of the Logger class within the class you wish to have this logger run for and give it the class's name.
Once you have an object for the logger, replace all instances of your print statements to the new object.
Now you will be able to decide if that print statement should be of type: log, debug, or error.
### Example:
The code before:
```python
class TestClass:
    def __init__(self):
        print('Object created')

    def something(self, number: str) -> int:
        print('We are here')
        
        try:
            return int(number)
        except ValueError as e:
            print(e)
            
            return 0
```
The updated code:
```python
from pretty_logger import Logger

class TestClass:
    logger: Logger
    
    def __init__(self):
        self.logger = Logger('TestClass')
        self.logger.log('Object created')

    def something(self, number: str) -> int:
        self.logger.debug('We are here')
        
        try:
            return int(number)
        except ValueError as e:
            self.logger.error(e)
            
            return 0
```

---

## Running a program which has a Pretty Logger
After the pretty logger has been implemented, you can use the following flags when launching your python script to activate the various logs:
- `--pretty-debug`: Allows for displaying debug/warn logs
- `--pretty-error`: Allows for displaying error logs
- `--pretty-all`: Activates all logs for script
- `--pretty-none`: Disables all logs for script

### Example:
This will run the script `main.py` with all the possible loggers:
```
python main.py --pretty-debug --pretty-error
```

---

## Buy me a coffee
If you wish to offer me a coffee, please buy yourself one instead and cheer in my name xD
