Class Based Logger for Python
Installation
pip install tdlogging
Doc
Configuration File
tdlogger.txt
A config text file for TDLogger
exceptionlog exceptionscountlog counttimelog time elapsedreturnlog return valueexeclog allpollwhether to poll for tdlogger.txt changespoll_periodseconds between each poll
TDLogger.py
TDLogger
Python Class
__init__
Constructor
file_pathpath of tdlogger.txtconfigcustom config in python dict that overrides tdlogger.txtaliasa name for your logger
.config()
Get the Logger decorator from its Configuration
ApplyDecorators
Python Function
Parameters
target_dirDirectory that is affectedimport_rootPython import name of your tdlogger instancevar_nameVariable name of the TDLogger instance in your fileforceWhether to ignore applying at the current file levelverboseWhether to log changes
DANGEROUS, use with caution
Apply decorators to every python file in the Directory, and also marking the file
RemoveDecorators
Python Function
Parameters
target_dirDirectory that is affectedimport_rootPython import name of your tdlogger instancevar_nameVariable name of the TDLogger instance in your fileforceApply Changes without confirmationverboseWhether to log changes
DANGEROUS, use with caution
Remove decorators to every python file in the Directory, and also removing the mark headings
Usage
Example
📦example
┣ 📂cool
┃ ┣ 📂cooler
┃ ┃ ┣ 📜sleep.py
┃ ┃ ┗ 📜init.py
┃ ┣ 📜fib.py
┃ ┗ 📜init.py
┣ 📜logger_instance.py
┣ 📜playground.py
┣ 📜tdlogger.txt
┗ 📜init.py
# example/tdlogger.txt
exception = False
count = False
exec = True
time = False
return = False
poll = False
poll_period = 5
# example/cool/fib.py
class Fib:
@staticmethod
def get_n(n):
a = 0
b = 1
if n == 0:
return a
elif n == 1:
return b
else:
for i in range(2, n):
c = a + b
a = b
b = c
return b
# example/cool/cooler/sleep.py
import time
class Sleep:
@staticmethod
def sleep(n):
time.sleep(n)
# example/logger_instance.py
from tdlogging.tdlogger import TDLogger
logger = TDLogger(alias="My Custom Logger").config()
# example/playground.py
from tdlogging.tdlogger import ApplyDecorators, RemoveDecorators
ApplyDecorators(target_dir="cool", import_root="example.logger_instance", var_name="logger", force=True)
for i in range(12):
from example.cool.cooler.sleep import Sleep
from example.cool.fib import Fib
print(Fib.get_n(i))
Sleep.sleep(1)
RemoveDecorators(target_dir="cool", import_root="example.logger_instance", var_name="logger", force=True)
> python example/playground.py
Added 6 lines to 2 file(s) .
┎────────────────────────────┒
┃ --Method Execution-- ┃
┃ Alias: My Custom Logger ┃
┃ Class: Fib ┃
┃ Method: get_n ┃
┃ Count: 1 ┃
┃ Exec Time: 0.000s ┃
┃ Return Value: 0 ┃
┃ Return Type: <class 'int'> ┃
┃ Arguments: { ┃
┃ 'n': 0 ┃
┃ } ┃
┃ tdlogger ┃
┖────────────────────────────┚
0
┎─────────────────────────────────┒
┃ --Method Execution-- ┃
┃ Alias: My Custom Logger ┃
┃ Class: Sleep ┃
┃ Method: sleep ┃
┃ Count: 1 ┃
┃ Exec Time: 1.001s ┃
┃ Return Value: None ┃
┃ Return Type: <class 'NoneType'> ┃
┃ Arguments: { ┃
┃ 'n': 1 ┃
┃ } ┃
┃ tdlogger ┃
┖─────────────────────────────────┚
3
.
.
.
┎─────────────────────────────────┒
┃ --Method Execution-- ┃
┃ Alias: My Custom Logger ┃
┃ Class: Sleep ┃
┃ Method: sleep ┃
┃ Count: 12 ┃
┃ Exec Time: 1.000s ┃
┃ Return Value: None ┃
┃ Return Type: <class 'NoneType'> ┃
┃ Arguments: { ┃
┃ 'n': 1 ┃
┃ } ┃
┃ tdlogger ┃
┖─────────────────────────────────┚
Removed 6 lines from 2 file(s) .
Process finished with exit code 0
Change log
[0.0.5] - 2020-04-12
Added
ApplyDecorator()RemoveDecorator()
[0.0.4] - 2020-04-02
Fixed unable to install
[0.0.3] - 2020-04-02
Fixed Markdown file
[0.0.2] - 2020-04-02
Added
tdprinter.py
Edited
tdprinter.pytdlogger.py
[0.0.1] - 2020-04-01
Added
tdlogger.pyHISTORY.mdREADME.md
Metadata
Release files for tdlogging 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tdlogging-0.0.6.tar.gz | 9.5 kB | Without provenance | Details for tdlogging-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tdlogging-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for tdlogging-0.0.6-py3-none-any.whl |
Total release size: 20.5 kB
Release files / tdlogging-0.0.6.tar.gz
| Download URL | tdlogging-0.0.6.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b2fca2cb6a8c6650e9c3c297175127d1d574362e7900b21a635eb8105d0f7cd4
|
|
BLAKE2b-256 checksum How to use checksums |
bb1b7f20b0c58f86e0e421f7490874562f2da1096ef20592391717c05d8db244
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.4
|
Release files / tdlogging-0.0.6-py3-none-any.whl
| Download URL | tdlogging-0.0.6-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f35efb301a376b4a415df6b393566e028dd2c9134809b2deedd7af73f5315b3e
|
|
BLAKE2b-256 checksum How to use checksums |
62a14e1e17951b54161c8a8075c5a0c02d430456171a8a196e97fcc03b360b5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.4
|
Security for tdlogging 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.