json supported easy debugger for python, in files. can also read.
Project description
filewriter 2.0.2
Hello.
I am an easy debugger which prints into files. I can also read. In case you need me ever.
Simplicity within a certain complexity.
Install
pip install filewriter
Documentation
param: filename
Name of the file. The extension .log
will be added.
Default: debug
ENV name: READABLE_GLOBAL_VARIABLE_NAME
param: debug
If set True, prints what's going on. Default: True
param: json
If set True, it will enable json conversion Default: True
param: callback
If set (a function), the function gets executed with the path of created file. Default: None
Examples
from filewriter import Writer, Reader, Reverse
# creates a file called debug.log and saves into
Writer() << {'allah': 'birdir'}
>>> {"allah": "birdir"}
# reverse the operator, if that's easier to read
# https://docs.python.org/3/reference/simple_stmts.html#assignment-statements
Reverse({'allah': 'birdir'}) >> Writer()
>>> {"allah": "birdir"}
# reads from debug.log
test = Reader().data
print(test)
>>> {'allah': 'birdir'}
# delete callback
import os
Writer(callback: lambda filename: os.remove(filename)) >> {'test': 'callback'} # deletes the file
API
filewriter.Writer
Writer(
filename="debug",
debug=True,
json=True,
ext="log",
callback=None,
)
filewriter.Reader
Reader(
filename="debug",
debug=True,
ext="log",
json=True,
)
filewriter.Reader().data
Set from file after the initialization
Twitter: @ebsaral
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
filewriter-2.0.2.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for filewriter-2.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e697f6167c2e6044b60a8e3c79fba640e5ef3e4ae8956f0e3a88529ae3f61764 |
|
MD5 | 57fd5d83e8c58088a07df17bac1155f0 |
|
BLAKE2b-256 | 20802f8d949c22db149996b97ece89101399cc48b5543cec78778c7c72bf8e7e |