Skip to main content

easy log use for extra infos

Project description


easy use for log with extra infos


  • very easy to use
  • log file name change from date
  • DayRottingLogger
  • safe extra fields
  • log multi vars and not just str
  • multiline log and indent for json
  • debug as default level


$ pip install logz


Simple Use

from logz import log
log.debug('debug msg')'info msg')
log.warning('warning msg')
log.error('error msg')
log.critical('critical mst')
    assert 0
except AttributeError as ex:


2019-12-12 22:39:43,584 DEBUG debug msg
2019-12-12 22:39:43,584 INFO info msg
2019-12-12 22:39:43,584 WARNING warning msg
2019-12-12 22:39:43,585 ERROR error msg
2019-12-12 22:39:43,585 CRITICAL critical mst
Traceback (most recent call last):
  File "/Users/apple/Documents/Projects/logz/logz/", line 199, in <module>
    assert 0

log multi vars one time

a = 'hello'
b = 1
c = [2]
d = {'name': 'kevin'},b,c,d)


2019-12-12 22:40:20,221 INFO hello 1 [2] {'name': 'kevin'}

Note: Change args form supporting %s format to supporting multi vars if you want to use something like:

import logging'name=%s,age=%d', 'kevin',18)

you neet use like below:

form logz import log'name=%s,age=%d' % ('kevin',18))


2019-12-12 22:41:58,024 INFO name=kevin,age=18

log to file


Note: logs directory must be exists

By default it's a rotting file and maxBytes=10240 and backUps=5

log to a file with name changes with date


And it's a day rotting file

change log level

log.level = 'info'
log.level = 20
log.debug('not show')'show info')


2019-12-12 22:43:24,479 INFO show info

level string is not case sensitive

change log format

log.format = '%(asctime)s %(levelname)s %(name)s %(message)s'

with extra fields

log.format = '%(asctime)s %(levelname)s %(user)s %(message)s''hello with no user')'hello with kevin', extra={'user': 'kevin'})


2019-12-12 22:45:18,604 INFO None hello with no user
2019-12-12 22:45:18,604 INFO kevin hello with kevin

multiline and indent for dict{'foo': 'bar'}, indent=2)


2019-12-09 19:30:16,419 DEBUG log None ->
  "foo": "bar"


  • log file to config maxBytes or else
  • log to html
  • log to email
  • log to db
  • log diff
  • log assert
  • log print
  • log to server using websocket
  • more decorators such as @explain @exception @timeit @email
  • support verbosity


  • logit not support instance method

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 logz, version 0.14
Filename, size File type Python version Upload date Hashes
Filename, size logz-0.14.tar.gz (6.2 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