Hello.
I am an easy debugger which prints into files, but can be used multi functional for production as well. I can also read. In case you need me ever.
Simplicity within a certain complexity.
pip install filewriter
Name of the file. The extension .log
will be added.
Default: debug
ENV name: READABLE_GLOBAL_VARIABLE_NAME
If set True, prints what's going on. Default: True
If set True, it will enable json conversion Default: True
If set (a function), the function gets executed with the path of created file. Default: None
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
Writer(
filename="debug",
debug=True,
json=True,
ext="log",
callback=None,
)
Reader(
filename="debug",
debug=True,
ext="log",
json=True,
)
Set from file after the initialization
Twitter: @ebsaral