Skip to main content

A simple logging package

Project description

log21

version stars forks repo size CodeFactor

A simple logging package that helps you log colorized messages in Windows console and other operating systems.

Features

  • Colors : The main reason for this package was to log text in the Windows console with the support of ANSI colors.
  • Argument parsing : log21's argument parser can be used like python's argparse, but it also colorizes the output.
  • Logging : A similar logger to logging. Logger but with colorized output and other options such as levelname modifications. It can also decolorize the output if you want to log into a file.
  • Pretty printing : Have you ever wanted to colorize the output of the pprint module? log21's pretty printer can do that.
  • Tree printing : You can pass a dict or list to log21.tree_print function, and it will print it in a tree-like structure. It's also colorized XD.
  • ProgressBar : log21's progress bar can be used to show progress of a process in a beautiful way.
  • LoggingWindow : Helps you to log messages and debug your code in a window other than the console.
  • CrashReporter : log21's crash reporter can be used to report crashes in different ways. You can use it to log crashes to console or files or use it to receive crash reports of your program through email. And you can also define your own crash reporter functions and use them instead!
  • Argumentify : You can use the argumentify feature to decrease the number of lines you need to write to parse command-line arguments. It's colored by the way!
  • Any idea? Feel free to open an issue or submit a pull request.

Issues contributors

Installation

Well, this is a python package so the first thing you need is python.

If you don't have python installed, please visit Python.org and install the latest version of python.

Then you can install log21 using pip module:

python -m pip install log21 -U

Or you can clone the repository and run:

pip install .

Or let the pip get it using git:

pip install git+https://github.com/MPCodeWriter21/log21

Changelog

v3.0.2

Change argumentify to use the whole function description as the argument-parser description instead of the one-line short description.

  • Example:
def main(verbose: bool = False) -> None:
    """This is a very useful tool and I will describe it thoroughly. It is so good that
    we have a second line in the first part of the description.

    And now we can talk more about the tool...

    :param verbose: This flag will make the logs more verbose!
    """

argumentify(main)

The way old versions would look:

usage: test.py [-h] [--verbose]

This is a very useful tool and I will describe it thoroughly. It is so good that

options:
  -h, --help
                        show this help message and exit
  --verbose, -v
                        This flag will make the logs more verbose!

Now at v3.0.2:

usage: test.py [-h] [--verbose]

This is a very useful tool and I will describe it thoroughly. It is so good that we have a
second line in the first part of the description. And now we can talk more about the tool...

options:
  -h, --help
                        show this help message and exit
  --verbose, -v
                        This flag will make the logs more verbose!

Full CHANGELOG

Usage Examples

See EXAMPLES.md

About

Author: CodeWriter21 (Mehrad Pooryoussof)

GitHub: MPCodeWriter21

Telegram Channel: @CodeWriter21

License

License

apache-2.0

Donate

In order to support this project you can donate some crypto of your choice 8D

Donate Addresses

Or if you can't, give this project a star on GitHub :)

References

Project details


Release history Release notifications | RSS feed

This version

3.0.2

Download files

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

Source Distribution

log21-3.0.2.tar.gz (78.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

log21-3.0.2-py3-none-any.whl (85.6 kB view details)

Uploaded Python 3

File details

Details for the file log21-3.0.2.tar.gz.

File metadata

  • Download URL: log21-3.0.2.tar.gz
  • Upload date:
  • Size: 78.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for log21-3.0.2.tar.gz
Algorithm Hash digest
SHA256 072bb9239b75a16f6dacf6625aa93175e1d32c1a9ac5e41cb2ea085c0538593a
MD5 b682bde4d8d07ee460486459e40a32a3
BLAKE2b-256 6669c048d8095a3194b7cc51cef9514c2d91d96cafca3b0bd19388774e5902f5

See more details on using hashes here.

File details

Details for the file log21-3.0.2-py3-none-any.whl.

File metadata

  • Download URL: log21-3.0.2-py3-none-any.whl
  • Upload date:
  • Size: 85.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for log21-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 28840dda300a630c8cdc2623222e7b6c4cca4c86b2998004b01d55a387ccc45b
MD5 110379a2ff6547cdc86609ad1cec5ca5
BLAKE2b-256 48024e2dfdcd4eeadde467b0003148d9f38da348b4f55c5107e5f08aa7b3fb01

See more details on using hashes here.

Supported by

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