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
Writer() << {'allah': 'birdir'}
>>> {"allah": "birdir"}
Reverse({'allah': 'birdir'}) >> Writer()
>>> {"allah": "birdir"}
test = Reader().data
print(test)
>>> {'allah': 'birdir'}
import os
Writer(callback: lambda filename: os.remove(filename)) >> {'test': 'callback'}
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