Skip to main content

python logging on steroids, lightweight and convenient

Project description


Life is too short. Use nanolog to make logging and printing simpler!

nanolog features a convenient logger API built on top of python’s builtin logging.

The library also ships with many printing utilities. Python 3 only.


pip install nanolog


import nanolog as nl

logger = nl.Logger.get_logger(
)'my', 3, 'world', 1/16.)  # just like print
# >>> my 3 world 0.0625

logger.warningfmt('{}, we are {:.3f} miles from {planet}',
                  'Houston', 17/7, planet='Mars')  # just like str.format
# >>> Houston, we are 2.429 miles from Mars

Use a trailing number to indicate level, the larger the higher priority

logger.info7(...)  # info level 7
logger.errorfmt8(...)  # error level 8

Display a banner line or block

logger.infobanner3('my', 3, 'world', symbol='!', banner_len=16, banner_lines=3)


!!!!!!!! my 3 world !!!!!!!!

Of course, banner method also comes with a str.format version

    '{3}&{0}&{2}&{1}', 'a', 'b', 'c', 'd',
    symbol='<*_*>', banner_len=16, banner_lines=6


<*_*><*_ d&a&c&b <*_*><*_

Logger config


Time formatting


Printing utililites


Better alternatives for the pprint module in python standard lib.

  • pprint: takes variable number of objects, just like print()
  • pprintstr: return string instead of printing to IO stream
  • pprintfmt: just like print('...'.format)
  • pprintfmtstr: return string instead of printing to IO stream

Convenient aliases:

original short
pprint pp
pprintstr pps
pprintfmt ppf
pprintfmtstr ppfs

TODO: talk about global configs

Project details

Download files

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

Files for nanolog, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size nanolog-0.1-py3-none-any.whl (14.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size nanolog-0.1.tar.gz (12.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page