pybraflog Readme 📜
Brainstorming package to manage logs in txt file
Installation ⚡
Opérating system : Windows, MacOS & Linux :
Available function/class 📑
FileLog
to create => FileLog(afilename, adeffolder)
adeffolder : folder to write file. if not exist or empty error.
afilename : the file name to write.
to open log => openlog
Open the log file.
to write info in log => writeLog(alog, anbrident)
alog : a line to add in file log. wothout add \n at the end to CRLF.
anbrident : to define indentation, number of space to add before alog, by default 0.
to clear log => clearoldlog(aretentionday)
to erase all log old than aretentionday, by default 15 days(optional).
You need to do when the filelog is open.
to close log => closelog()
Close the log file.
Log
to create => Log()
properties
value : for log in one line.
valuelst : for log in more lines.
to clear all logs -> clear(self)
clear clear log list and log str
to count log => count(self)
return the number of element in Valuelst
tostring(self, acharsep)
get value list in string seperated by acharsep (by default acharsep = '\n\r')
get a log tag => getlogtag(self, asep)
return a log tag formated %Y-%m-%d %H:%M:%S with asep at the end (by default asep = '')
Howto use 📰
import os
import pybraflog
import pybrafile
flog = pybraflog.FileLog('testlog.txt', '')
if flog.iserror:
print(flog.error)
flog = pybraflog.FileLog('testlog.txt', os.getcwd())
flog.openlog()
flog.writeLog('first line')
flog.writeLog('first line indent', 10)
flog.writeLog('two line')
flog.closelog()
file = pybrafile.FileUtils('testlog.txt')
file.openfile('r')
txt = file.readfile()
file.close()
print(txt)
print(pybraflog.version())
print(txt)
print(pybraflog.version())
lstlog = pybraflog.Log()
lstlog.Valuelst = lstlog.getlogtag(' - ') + 'Line 1'
lstlog.Valuelst = lstlog.getlogtag(' _ ') + 'Line 2'
lstlog.Valuelst = lstlog.getlogtag(' # ') + 'Line 3'
lstlog.Valuelst = lstlog.getlogtag() + 'Line 4'
print('Nbr element(s) in value list :' + str(lstlog.count()))
print('Value lsit :\r\n' + lstlog.tostring())
Meta 💬
Brainstorming – Support.erp@brainstorming.eu
Distributed under the MIT license. See LICENSE for more information.
Release files for pybraflog 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pybraflog-0.1.3.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pybraflog-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.1 kB
Release files / pybraflog-0.1.3.tar.gz
| Download URL | pybraflog-0.1.3.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b71082bcc78d1b6f3911872139defdaa71bfc3d11cc812d934717e8fc95d3f52
|
|
BLAKE2b-256 checksum How to use checksums |
3dbd446c99913cc6a735aeaed641f3ca0448074c27393705d0bd1f8cef05d80d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.11 Windows/10
|
Release files / pybraflog-0.1.3-py3-none-any.whl
| Download URL | pybraflog-0.1.3-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c482dbc581bfe6157875fae8c41485acd1fc3f8e81e0f433c7166e8dfc30494
|
|
BLAKE2b-256 checksum How to use checksums |
682f9f3275d0d883c49788b837523f9a04473f0c7d1eae618fdee0a867f24eef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.11 Windows/10
|