Metadata-Version: 2.1
Name: pybraflog
Version: 0.1.3
Summary: Brainstorming package to manage logs in txt file
License: MIT
Author: Brainstorming
Author-email: Support.erp@brainstorming.eu
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: pybrafile (>=0.1.3)
Description-Content-Type: text/markdown

# 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.
