Logzero

Latest version: v1.7.0

Safety actively analyzes 681866 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 3

1.2.1

------------------

- Logfiles with custom loglevels (eg. stream handler with DEBUG and
file handler with ERROR).

1.2.0

------------------

- Way better API for configuring the default logger with <span
class="title-ref">logzero.loglevel(..)</span>, <span
class="title-ref">logzero.logfile(..)</span>, etc.
- Built-in rotating logfile support.

python
import logging
import logzero
from logzero import logger

This log message goes to the console
logger.debug("hello")

Set a minimum log level
logzero.loglevel(logging.INFO)

Set a logfile (all future log messages are also saved there)
logzero.logfile("/tmp/logfile.log")

Set a rotating logfile (replaces the previous logfile handler)
logzero.logfile("/tmp/rotating-logfile.log", maxBytes=1000000, backupCount=3)

Disable logging to a file
logzero.logfile(None)

Set a custom formatter
formatter = logging.Formatter('%(name)s - %(asctime)-15s - %(levelname)s: %(message)s');
logzero.formatter(formatter)

Log some variables
logger.info("var1: %s, var2: %s", var1, var2)

1.1.2

------------------

- Better reconfiguration of handlers, doesn't remove custom handlers
anymore

1.1.0

------------------

- Global default logger instance (<span
class="title-ref">logzero.logger</span>)
- Ability to reconfigure the default logger with (<span
class="title-ref">logzero.setup\_default\_logger(..)</span>)
- More tests
- More documentation

1.0.0

------------------

- Cleanup and documentation

0.2.0

------------------

- Working logzero package with code and tests

Page 2 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.