Skip to main content

S_Logger

Project description

# S_Logger
Simple to use logger for Python code.

## Description
It is wrapper for general Python logger.

## Dependencies
- __python 3.6__ or more (maybe will be work on Python 2.x, but I didn't test it).
- module [__PyYAML==3.12__](https://pyyaml.org/) or more (needed for file settings.
You will install from __pip__, ex.: __pip3 install PyYAML__)

## How use
File __test.py__ have a little example.
- need install module: __pip install s_logger__
- create **'logger_settings.yaml'**. See format [below](#format-logging_settingyaml)
- in your code need use import fro importing module
```pyhton
from s_logger.S_Logger import S_Logger
```
- create the object of class S_Logger and give it settings file name

```python
log = S_Logger()
```
- get logger for current script
```python
logger = log.get_logger(__file__)
```

#### Example:
```python
from s_logger.S_Logger import S_Logger


if __name__ == '__main__':
log = S_Logger()
# Show current log file names
print(str(log))

# Get logger for this file
logger = log.get_logger(__file__)

# Different of level log test
logger.critical('Test logger: CRITICAL msg')
logger.fatal('Test logger: FATAL msg')
logger.error('Test logger: ERROR msg')
logger.warning('Test logger: WARNING msg')
logger.info('Test logger: INFO msg')
logger.debug('Test logger: DEBUG msg')
```

### format logging_setting.yaml:
```
values:
log_folder: '/Users/same_user/logs'
general_log_name: 'general.log'
error_log_name: 'error.log'

default_log_level: 'DEBUG'
general_log_level: 'DEBUG'
error_log_level: 'ERROR'
console_log_level: 'DEBUG'
```

#### params
- __log_folder__ - path to folder for stored log files
- __general_log_name__ - file name of general log
- __error_log_name__ - file name of error log
- __default_log_level__ - minimal level value of default log
- __general_log_level__ - minimal level value of general log
- __error_log_level__ - minimal level value of error log
- __console_log_level__ - minimal level value of console output

## Current version: 1.0.1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for S_Logger, version 1.0.1b0
Filename, size File type Python version Upload date Hashes
Filename, size S_Logger-1.0.1b0.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page