Skip to main content

An easy use and more powerful android style logging util

Project description

tinylogger

An easy use and more powerful android style logging util

Installation

To install tinylogger run this command:

pip install tinylogger

or download Package then run this command:

pip install tinylogger-1.0.0-py3-none-any.whl

Usage

Basic Usage

The typical usage of this library is like the following:

from tinylogger.log import Log

if __name__ == "__main__":
    Log.d("test")

output to stdout and log file in current work dir

2019-08-25 07:49:48.780000 - INFO  - log.py    (_get_instance:69): log path: D:\
develop\test\log_20190825_074948.txt
2019-08-25 07:49:48.782000 - DEBUG - test.py   (__main__  :8): test

Full Usage

Or like this:

import os
import logging
from tinylogger.log import Log


if __name__ == "__main__":
    Log.setup(os.path.join(os.getcwd(), "log"), logging.DEBUG)
    Log.d("test")

output to stdout and log file in current work dir

2019-08-25 07:52:32.514000 - INFO  - log.py    (setup     :78): log path: D:\dev
elop\test\log\log_20190825_075232.txt
2019-08-25 07:52:32.515000 - DEBUG - test.py   (__main__  :8): test

Quiet print

If you don't want to print log in stdout, then setup as below:

Log.setup(os.path.join(os.getcwd(), "log", True), 

Custom Configs

setup(cls, log_dir=os.path.join(os.getcwd()), log_level=logging.DEBUG, quiet=False)
log_dir: the dir to write log file
log_level: control log msg to log file expect stdout
quiet: do not print log in stdout

Distribute

cd path/to/tinylogger-dist/
python -m venv venv
venv\Scripts\activate.bat
pip install -r requirements.txt
python setup.py bdist_wheel
twine upload dist/*

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

tinylogger-1.0.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file tinylogger-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: tinylogger-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4

File hashes

Hashes for tinylogger-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e109450f2198ae465b95a461a3a64c2360d9f80af100cc0210a86157f6d71b61
MD5 9abb60e70fcf52eb0f45e0e551edbc54
BLAKE2b-256 5e73d4839308f1229faef2427c9ebc4ec0acc19085e1e595f1789dffe4deee04

See more details on using hashes here.

Supported by

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