exlogging
Supports to setup python standard logging package.
How to use
The way to use exlogging almost same with Python standard logging. First, you can call init function with config dict. After that, completely same with logging.
import exlogging
config = {
'file': {
'level': 'debug',
'filename': '/path/to/logfile'
}
# You can conbinate with other handlers.
}
# If you call init function without second parameter(name), exlogging setup root logger.
exlogging.init(config)
bloging.debug("Hello exlogging!")
# If you want to use named logger, you can call init function with config and name
exlogging.init(config, 'example')
# You can access named logger via getLogger function
example_logger = exlogging.getLogger('example')
example_logger.info('You named logger')
exlogging or getLogger response object has debug, info, warning, error, exception and critical functions. If you pass ‘warning` as level in config dict to init function, when you call warning, error, critical or critical, it will be logged, but when you call info or debug function, it is not logged.
Logger is common in your application, so you can setup logger via exlogging at your application entry point, you can use the logger anywhere.
Handlers
Common settings
All handlers have level and format.
Levels
critical
error
warning
info
debug
notset
Format
If you don’t pass log_format here, exlogging uses this format: %(levelname)s %(name)s - %(asctime)s - File: %(pathname)s - Line: %(lineno)d - Func: %(funcName)s Message: %(message)s
See https://docs.python.org/3.5/library/logging.html#logrecord-attributes
FileHandler
When you call logger function, record the message in file at filename.
'file': {
'level': str, # requirement
'format': str, # optional
'filename': str # requirement
}
RotatingFileHandler
When you call logger function, record the message in file at filename.
'file': {
'level': str, # requirement
'format': str, # optional
'filename': str, # requirement
'max_bytes': int, # optional
'backup_count': int # optional
}
EmailHandler
When you call logger function, send an email with the message.
'email': {
'level': str, # requirement
'format': str, # optional
'smtp_host': str, # requirement
'smtp_port': int, # requirement
'email_from': str, # requirement
'email_to': str, # requirement
'email_subject': str, # requirement
'smtp_username': str, # requirement
'smtp_password': str # requirement
}
Metadata
Release files for exlogging 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| exlogging-0.1.5.tar.gz | 3.6 kB | Without provenance | Details for exlogging-0.1.5.tar.gz |
Release files / exlogging-0.1.5.tar.gz
| Download URL | exlogging-0.1.5.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
acb24b7f1b8a69fb2d9c5989d05dd48f816294db1f08bb633475125cd0207f4c
|
|
BLAKE2b-256 checksum How to use checksums |
fc24db5cf29b065297adec2c4d764641131869e41bfd3316db85597004e40d9d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for exlogging 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.