Skip to main content

Comment-driven python loggin package

Project description

Logger LOCO

LoCo = log via comments
Python >= 3.6 only

Usage:

import logging
from logger_loco import loco

logger = logging.getLogger('mylogger')

@loco(logger)
def somefunc(a, b):
  # This is a regular comment

  c = a + b 

  #@ This is debug  
  #- This is info 
  #! This is warning
  #X This is error

  #@ You could also use variables interpolation: {a} + {b} = {c}

  #-->
  #@ This is indented log
  #-->
  #@ This is deeper indented log
  #<--
  #<--
  #@ This is not indented log

somefunc(1, 2)

@loco(logger)
class Someclass(object):
  def mymethod(self):
    #@ Also works with classes
    pass

Someclass().mymethod()

Will print:

DEBUG: This is debug
INFO: This is info
WARNING: This is warning
ERROR: This is error
DEBUG: You could also use variables interpolation: 1 + 2 = 3
DEBUG:   This is indented log
DEBUG:     This is deeper indented log
DEBUG: This is not indented log
DEBUG: Also works with classes

Development

Deploy package to <test.pypi.org>:

python3 setup.py sdist
python3 -m twine upload ---repository-url https://test.pypi.org/legacy/ dist/*

Deploy package to <pypi.org>:

rm -rf dist/
python3 setup.py sdist
python3 -m twine upload dist/*

Project details


Download files

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

Source Distribution

logger-loco-0.1.2.tar.gz (2.8 kB view details)

Uploaded Source

File details

Details for the file logger-loco-0.1.2.tar.gz.

File metadata

  • Download URL: logger-loco-0.1.2.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.1 requests-toolbelt/0.8.0 tqdm/4.46.0 CPython/3.6.9

File hashes

Hashes for logger-loco-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ba904b2eecc61c8aa24013c0cfe730f4132184d549fe8575553cf242ee0ed3b0
MD5 ebe5ad9edcc45b512de6fa4ed206d5d8
BLAKE2b-256 6b7222294e2e7b8d5b6ede0c620f8931d07bbf5fa27011f90786e8558514d001

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page