Brainstorming package to manage logs in txt file
Project description
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.
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
pybraflog-0.1.3.tar.gz
(4.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pybraflog-0.1.3.tar.gz.
File metadata
- Download URL: pybraflog-0.1.3.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.11 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b71082bcc78d1b6f3911872139defdaa71bfc3d11cc812d934717e8fc95d3f52
|
|
| MD5 |
a25b05e1a18a0cb59e4e4b1476c4196a
|
|
| BLAKE2b-256 |
3dbd446c99913cc6a735aeaed641f3ca0448074c27393705d0bd1f8cef05d80d
|
File details
Details for the file pybraflog-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pybraflog-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.11 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c482dbc581bfe6157875fae8c41485acd1fc3f8e81e0f433c7166e8dfc30494
|
|
| MD5 |
6a3460a1ba0e5187a5ad29feb3a48b7a
|
|
| BLAKE2b-256 |
682f9f3275d0d883c49788b837523f9a04473f0c7d1eae618fdee0a867f24eef
|