Package: lib-log-utils
lib_log_utilsVersion v1.4.15 as of 2023-07-21 seeChangelogthis library makes it easy to log colored messages from python and from the commandline. Text Wrapping is supported.whenever possible, it tries to autodetect the correct settings for colored output.currently the settings for TRAVIS and BINDER/Jupyter are detected automaticallyautomated tests, Github Actions, Documentation, Badges, etc. are managed withPizzaCutter(cookiecutter on steroids)Python version required: 3.8.0 or newertested on recent linux with python 3.8, 3.9, 3.10, 3.11, 3.12-dev, pypy-3.9, pypy-3.10 - architectures: amd64good code coverage, flake8 style checking ,mypy static type checking ,tested underLinux, macOS, Windows, automatic daily builds and monitoringTry it OnlineUsageUsage from CommandlineInstallation and UpgradeRequirementsAcknowledgementsContributeReport IssuesPull RequestCode of ConductLicenseChangelogTry it OnlineYou might try it right away in Jupyter Notebook by using the “launch binder” badge, or clickhereUsagePythonimport the module and check the code - it is very easy and documented thereas soon as I have some time, this will be completed (help welcome)CommandlineUsage:log_util(-h|--version|--program_info)log_util[Options]"<message>"log_util"<message>"[Options]Options:-h,--helpshowhelp--versionshowversion--program_infoshowProgramInfoArgumentsmessagethe message to logOptionsoptiondescription-l –level <level>the log level as number or predefined value, default = INFO-b –bannerlog as banner-w –width <width>the width of the message or the banner, if text wrap is used, default = 140-s –silent <True|False> **disables the output if set to “True” (not case sensitive)**, default = False-q –quietdisables the output (as flag), default = False-f –forcetake precedence over environment settings, default = False–wrap –nowrapuse text wrap (this is the default value), default = True–traceback –no-tracebackshow traceback on commandline error, default = False-e –extendedextended log format, default = plain-p –plainplain log format, default = plain-c –colortestcolor test**This makes it possible to silence messages elegantly in a shellscript:#!/bin/bash# disable deprecation messagesDEP_MSG_OFF="True"......log_util-lwarning"some deprecation message"--silent=${DEP_MSG_OFF}log_util-linfo"another deprecation message"--silent=${DEP_MSG_OFF}...log levelsTextIntegerNOTSET0SPAM5DEBUG10VERBOSE15INFO20NOTICE25WARNING30SUCCESS35ERROR40CRITICAL50Environment Settingsenvironment variablefunctionLOG_UTIL_FMTthe log format - either “plain”, “extended” or a custom formatting string, default = plainLOG_UTIL_LEVELthe level of the logger, one of the predefined log levels, or “0” - “50”, default = 0LOG_UTIL_WIDTHthe banner width if text wrap is used, must be >=”10”, default = 140LOG_UTIL_WRAPif text wrap should be used, must be True or False (not case sensitive), default = TrueLOG_UTIL_QUIETif the logger is used at all - must be True or False (not case sensitive), default = FalseCOLOREDLOGS_LOG_FORMATas described in coloredlogsCOLOREDLOGS_DATE_FORMATas described in coloredlogsCOLOREDLOGS_FIELD_STYLESas described in coloredlogsCOLOREDLOGS_LEVEL_STYLESas described in coloredlogsenvironment settings take precedence over commandline arguments, unless –force is passed to the commandlineEXAMPLES# multi-line bannerlog_util-lwarning"Line1${IFS}Line2${IFS}Line3"# only show log messages from level WARNING upwardsexportLOG_UTIL_LEVEL=WARNINGlog_util-linfo"spam"# this is not shownlog_util-lerror"ham"# this is shown# reset the log_level to 0 (the default value)unsetLOG_UTIL_LEVELUsage from CommandlineUsage: log_util [OPTIONS] [MESSAGE]

  colored log messages and banners from commandline and python

Options:
  --version                     Show the version and exit.
  -e, --extended                extended log format
  -p, --plain                   plain log format
  -b, --banner                  log as banner
  -w, --width INTEGER           wrap width, default=140
  --wrap / --nowrap             wrap text
  -s, --silent TEXT             disable logging if "True"
  -q, --quiet                   disable logging as flag
  -f, --force                   take precedence over environment settings
  -l, --level TEXT              log level as number or predefined Level
  --program_info                get program info
  -c, --colortest               color test
  --traceback / --no-traceback  return traceback information on cli
  -h, --help                    Show this message and exit.Installation and UpgradeBefore You start, its highly recommended to update pip and setup tools:python -m pip --upgrade pip
python -m pip --upgrade setuptoolsto install the latest release from PyPi via pip (recommended):python -m pip install --upgrade lib_log_utilsto install the latest release from PyPi via pip, including test dependencies:python -m pip install --upgrade lib_log_utils[test]to install the latest version from github via pip:python -m pip install --upgrade git+https://github.com/bitranox/lib_log_utils.gitinclude it into Your requirements.txt:# Insert following line in Your requirements.txt:
# for the latest Release on pypi:
lib_log_utils

# for the latest development version :
lib_log_utils @ git+https://github.com/bitranox/lib_log_utils.git

# to install and upgrade all modules mentioned in requirements.txt:
python -m pip install --upgrade -r /<path>/requirements.txtto install the latest development version, including test dependencies from source code:# cd ~
$ git clone https://github.com/bitranox/lib_log_utils.git
$ cd lib_log_utils
python -m pip install -e .[test]via makefile:
makefiles are a very convenient way to install. Here we can do much more,
like installing virtual environments, clean caches and so on.# from Your shell's homedirectory:$gitclonehttps://github.com/bitranox/lib_log_utils.git$cdlib_log_utils# to run the tests:$maketest# to install the package$makeinstall# to clean the package$makeclean# uninstall the package$makeuninstallRequirementsfollowing modules will be automatically installed :## Project Requirementsclickcoloredlogscli_exit_toolslib_parameterlib_platformlib_programnameAcknowledgementsspecial thanks to “uncle bob” Robert C. Martin, especially for his books on “clean code” and “clean architecture”ContributeI would love for you to fork and send me pull request for this project.
-please ContributeLicenseThis software is licensed under theMIT license—Changelognew MAJOR version for incompatible API changes,new MINOR version for added functionality in a backwards compatible mannernew PATCH version for backwards compatible bug fixesv1.4.152023-07-21:require minimum python 3.8remove python 3.7 testsintroduce PEP517 packaging standardintroduce pyproject.toml build-systemremove mypy.iniremove pytest.iniremove setup.cfgremove setup.pyremove .bettercodehub.ymlremove .travis.ymlupdate black configclean ./tests/test_cli.pyadd codeql badgemove 3rd_party_stubs outside the src directory to./.3rd_party_stubsadd pypy 3.10 testsadd python 3.12-dev testsv1.4.14.22022-06-02: update to github actionscheckout@v3andsetup-python@v3v1.4.142022-03-29: remedy mypy type error in lob_log_utils_cliv1.4.132022-03-25:fix ValueError: underlying buffer has been detached on github Actions Windowsimplement github actionsupdate documentation and testslist ./dist dir if existingfix requirements.txtv1.4.102020-10-09: service releaseupdate travis build matrix for linux 3.9-devupdate travis build matrix (paths) for windows 3.9 / 3.10v1.4.92020-08-08: service releasefix documentationfix travisdeprecate pycodestyleimplement flake8v1.4.82020-08-01: fix doctests in windowsv1.4.72020-08-01: fix pypi deployv1.4.62020-07-31: fix travis buildv0.4.52020-07-29: fix environ.pop issue in doctestv0.4.42020-07-29: feature releaseuse the new pizzacutter templatev0.4.32020-07-27: feature releaseuse cli_exit_toolsadd banner parameter, to temporary disable/enable bannerv0.4.22020-07-23: separate travis profilev0.4.12020-07-23: change color profilesv0.4.02020-07-23: feature releasecorrect print_exception_traceback is stdout, stderr = Noneadded formatting parameter, custom log formatterv0.3.02020-07-22: feature releaseautodetect travis settingsautodetect binder/jupyter settingsv0.2.02020-07-22: feature releaselog_exception_traceback and print_exception_traceback will also report stdout, stderr if presentv0.1.42020-07-17: feature releasebump coveragev0.1.32020-07-17: feature releasecomprehensive–colortestautomatically select 8 colors profile for travisv0.1.22020-07-16: feature releasestore settings in environment for commandline usecleanuprelease on pypifix cli testenable traceback option on cli errorsjupyter notebookv0.1.12020-07-06: patch releasenew click cliuse PizzaCutter Templatev0.0.2developmentv0.0.12019-09-03: Initial public release