Provide a function for anyone who want to configure log parameters easily, just call init_log_config when your app start up, the you can use the module of logging which build-in python3 without any other configtur. This module support ConsoleHandler, RotatingFileHandler and SMTPHandler and You can change the configuration parameters according to your requirements.
Project description
Provide a function for anyone who want to configure log parameters easily, just call init_log_config when your app start up, the you can use the module of logging which build-in python3 without any other configtur. This module support ConsoleHandler, RotatingFileHandler and SMTPHandler and You can change the configuration parameters according to your requirements.
Meta
Author: Wu Charles
Email: wcadaydayup@163.com
Maintainer: Wu Charles
Email: wcadaydayup@163.com
Status: active development, stable, maintained
[![Version](https://img.shields.io/pypi/v/log_config.svg)](https://pypi.python.org/pypi/log_config) [![GitHub](https://github.com/wcadaydayup/log_config.svg?branch=master)](https://github.com/wcadaydayup/log_config)
Installation
Simply run the following from within a virtualenv:
$ pip install log_config or $ pip install git+https://github.com/wcadaydayup/log_config
Usage
Import the log config function in anywhere you want use logging which build-in Python3:
from log_config.log_config import init_log_config
Call init_log_config() when your application start up, of course you can modify log file path, log level and so on by import other variable from log_config.log_config:
init_log_config()
Log confiture is ready, you can use logging module without any other configture:
import logging logger = logging.getLogger() logger.debug("this is a message of debug level.")
Then, you will see you output message in console and log file which in your current directory:
configure_installed_apps_logger(logging.INFO, verbose=True, filename='django-project.log')
You can also receive email notify if call init_log_config(use_mail=True), of course you should provide correct email parameters:
import log_config.log_config as lf lf.EMAIL_HOST = "xxx.smtp.com" lf.FROM = "youraccount@xx.com" lf.TO = "a@xx.com;b@xx.com" ... init_log_config(use_mail=True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file log_config-2.0.tar.gz
.
File metadata
- Download URL: log_config-2.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 055515a25c5b43b7d6bb7c1560de6d6ab421f505b10738deeb06f1d2e315f129 |
|
MD5 | f990a9a9f897f17becb7c33942ad72de |
|
BLAKE2b-256 | 875c1044044181999a3bdb091dab6d167c09e4939a23ea3fe7c469f440c75581 |
File details
Details for the file log_config-2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: log_config-2.0-py2.py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26b4f406eec661c21fae5f56c3793f8a761e4d317694a5f130af16a6830aef5a |
|
MD5 | cfe58acc9e2ad55e54c7890ef5f6966f |
|
BLAKE2b-256 | 9dd787e29f420e27942376cfd478562d4a6e6d593e9ad3ef9b5ae3d5afcbaf48 |