Package: el-logging
Easily Launch Logging (el_logging)Loguru based custom logging package for simple python projects.FeaturesLoguru based logging -https://pypi.org/project/loguruCustom basic logging moduleLogging to files (all, error, json)Custom logging formatsCustom options as a configColorful loggingMultiprocess compatibility (Linux, macOS - 'fork', Windows - 'spawn')Installation1. PrerequisitesPython (>= v3.7)PyPi (>= v21)2. Install el-loggingA. [RECOMMENDED] PyPi install# Install or upgrade el-logging package:pipinstall--upgradeel-logging# To uninstall package:pipuninstall-yel-loggingB. Manually add to PYTHONPATH (Recommended for development)# Clone repository by git:gitclonegit@bitbucket.org:ellexiinc/el_logging.gitcdel_logging# Install python dependencies:pipinstall--upgradepip
catrequirements.txt|xargs-n1-L1pipinstall--no-cache-dir# Add current path to PYTHONPATH:exportPYTHONPATH="${PWD}:${PYTHONPATH}"C. Manually compile and setup (Not recommended)# Clone repository by git:gitclonegit@bitbucket.org:ellexiinc/el_logging.gitcdel_logging# Building python package:pipinstall--upgradepipsetuptoolswheel
pythonsetup.pybuild# Install python dependencies with built package to current python environment:pythonsetup.pyinstall--recordinstalled_files.txt# To remove only installed el-logging package:head-n1installed_files.txt|xargsrm-vrf# Or to remove all installed files and packages:catinstalled_files.txt|xargsrm-vrf3. Configuration (You can skip this step, if you don't want to configure)First, check.env.example (environment variables)file.Sample.env.examplefile -https://bitbucket.org/ellexiinc/el_logging/src/master/.env.exampleCopy.env.examplefile to.envand change environment variables:cp-v.env.example[PROJECT_DIR]/.envcd[PROJECT_DIR]nano.envMakeconfigsdirectory inside project's base directory and copyconfigs/logger.yamlfile intoconfigs.Samplelogger.ymlconfig file -https://bitbucket.org/ellexiinc/el_logging/src/master/configs/logger.yamlThen edit variable options:mkdir-vp[PROJECT_DIR]/configs

cp-vlogger.yaml[PROJECT_DIR]/configs/logger.yaml
rm-vflogger.yamlcd[PROJECT_DIR]nanoconfigs/logger.yamlUsage/ExamplesSample python file -https://bitbucket.org/ellexiinc/el_logging/src/master/sample.pyImport el_logging module:fromel_loggingimportloggerlogger.trace('Tracing...')logger.debug('Debugging...')logger.info('Logging info.')logger.success('Success.')logger.warning('Warning something.')logger.error('Error occured.')logger.critical('CRITICAL ERROR.')defdivide(a,b):_result=a/breturn_resulttry:divide(10,0)exceptExceptionaserr:logger.exception("Failed to divide:")Running TestsTo run tests, run the following command:python-munittesttests/test_*.pyEnvironment VariablesYou can use the following environment variables inside.envfile:ENV=developmentDEBUG=trueAPP_NAME=tsc_vraeLOGS_DIR="/var/log/app"ConfigurationYou can use the following sample configuration:logger:level:"INFO"use_color:trueuse_icon:falseuse_backtrace:truestd_format_str:"[<c>{time:YYYY-MM-DDHH:mm:ss.SSSZ}</c>|<level>{lvlname:<5}</level>|<w>{file}</w>:<w>{line}</w>]:<level>{message}</level>"use_log_file:falsefile_format_str:"[{time:YYYY-MM-DDHH:mm:ss.SSSZ}|{lvlname:<5}|{file}:{line}]:{message}"rotate_when:at_hour:0at_minute:0at_second:0rotate_file_size:10000000backup_file_count:50file_encoding:utf8all_log_filename:"{app_name}.std.all.log"err_log_filename:"{app_name}.std.err.log"use_log_json:falseuse_custom_json:falsejson_all_log_filename:"{app_name}.json.all.log"json_err_log_filename:"{app_name}.json.err.log"# logs_dir: /var/log/appReferenceshttps://github.com/Delgan/loguruhttps://loguru.readthedocs.io/en/stable/api/logger.html