
Product
Introducing Data Exports
Export Socket alert data to your own cloud storage in JSON, CSV, or Parquet, with flexible snapshot or incremental delivery.
log21
Advanced tools
A simple logging package that helps you log colorized messages in Windows console and other operating systems.
log21.tree_print function, and it
will print it in a tree-like structure. It's also colorized XD.
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
Add log21.helper_types module.
This module contains a collection of useful types meant for using with argument parser to parse CLI arguments to more usable formats.
FileSize: Can take str and int values. Will convert human inputs such as "121 KB",
"21MiB", or "4.56 GB" to bytes. Can also be used to represent bytes value in more
human-readable formats.For even more control you can still define Logger, Handlers, and Formatters manually.
from pathlib import Path
import log21
from log21.helper_types import FileSize
def main(path: Path, min_size: FileSize, max_size: FileSize, /):
log21.info(
"Files that are smaller than %s or bigger than %s will be ignored.",
args=(min_size, max_size),
)
for file in path.iterdir():
if not file.is_file():
continue
if min_size <= (size := file.stat().st_size) <= max_size:
log21.print(
"`%s` is %s.",
args=(file, FileSize(size).humanize(binary=False, fmt="%.4f")),
)
if __name__ == "__main__":
log21.argumentify(main)
Example usage and output:
$ uv run test.py . "1.23MiB" "0.5 GB"
[21:21:21] [INFO] Files that are smaller than 1.23 MiB or bigger than 476.84 MiB will be
ignored.
`myfile21.zip` is 35.1856 MB.
See EXAMPLES.md
Author: CodeWriter21 (Mehrad Pooryoussof)
GitHub: MPCodeWriter21
Telegram Channel: @CodeWriter21
In order to support this project you can donate some crypto of your choice 8D
Or if you can't, give this project a star on GitHub :)
FAQs
A simple logging package
We found that log21 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Export Socket alert data to your own cloud storage in JSON, CSV, or Parquet, with flexible snapshot or incremental delivery.

Research
/Security News
Bitwarden CLI 2026.4.0 was compromised in the Checkmarx supply chain campaign after attackers abused a GitHub Action in Bitwarden’s CI/CD pipeline.

Research
/Security News
Docker and Socket have uncovered malicious Checkmarx KICS images and suspicious code extension releases in a broader supply chain compromise.