Root для prology

prology

I present a clever logger and assistant for python.

Features

  • 📌 Simple & Powerful Standard Output with Notes
  • Traceback Call Trees of every Event
  • 📄 File Logging
  • ⌨️ Keylogging
  • 📨 Mail Delivery
  • ⏱ Benchmark Testing
  • 💤 Sleeper
  • 🔊 Text-to-Speech
  • 🚨 Alerts
  • ⚙️ Customizable
  • 🧲 Attractive

Dependencies

  • python 3.x
  • python3-pip (comes with python3 installation)

Acknowledging

Comes automatically with installation:

Index

  1. Intro
  2. Getting Started
     2.1 Installation
     2.2 Hello World
     2.3 Logging
  3. Usage
     3.1 logger
      3.1.1 logger.note
      3.1.2 logger.mail
     3.2 KeyLogger

Forget print()

Say good bye to print and hello to prology! This package was build to serve not only as a fancy console logger but moreover as a wise assistant within your python project to save you tons of hours for common routines. The prology logging goes beyond python, and yet may log every input event system wide. Not convinced? Take a look:

()

 .  
  ()

.()
Getting Started

Installation

Install within the prology root directory prompt

 prology/$ pip3 install 

then import prology into a custom python e.g. /project/

 .  
  ()

If an import error occurs during above initialization, this is probably because espeak is not installed yet. This can be solved by installing the requirements

$ sudo apt update  sudo apt install espeak ffmpeg libespeak1

Hello World in prology

 /project/$ [info][26.09.20 14:39:40]: Hello World

Logging

  (, )
.('This will be appended in the log file')
.('This will be appended as well')

Every note call called from this logger will be printed if detatch flag is False (default) and logged into the provided path. The root-directory is always the current working directory see os.getcwd() which is your /project/ directory.

~ /project/$ nano log.txt

[info][26.09.20 13:58:42]: This will be appended in the log file
[info][26.09.20 13:58:42]: This will be appended as well

You have a large project with many cross imports or confusing function calls? You are bored searching for bugs throughout a long chain of calls?
No worries! prology keeps track of the function branch from which the logger.note method was called.

 ():

    :

         ('This Function has errors')

       :

        .(, , , )

 ():

     ()

 ():

     ()

()

Built-In Text to Speech Synthesis

Bring your logger to life by one single bool flag

.('I am alive!', )

and listen to the voice of your logger. A useful option for alerting, informing or speech synth. development.

Дополнительно:  Root and alpine

Usage prology.log.

logger(filepath=None, overwrite=False) [object]

Main object for logging.

  • filepath [kwarg] (str)
    Default: None
    Log file path. Absolute and relative paths as well as custom file extensions are possible. The root path is the current working directory.
  • overwrite [kwarg] (bool)
    Default: False
    Overwrite the file. If disabled you can call several logger instances from plenty apps which will all append logs to the same file but make sure to give every logger instance a custom logType to distinguish them.

logger.note(input=», inputCol=None, logType=’info’, logTypeCol=None,showExcept=True, timestamp=True, fTree=False, benchMark=None, detatch=False, save=True, deliverTo=None, subject=None, wait=None, speak=False, forward=True, forwardBlock=False) [method]

mail

logger.mail(address, password, contacts, smtpServer=None, port=587) [method]

Initializes the mail service. This method is mandatory for sending mails and should be called at the beginning of the script. For example see deliverTo.

  • address [arg] (str)
    Provide a sender email address.
  • password [arg] (str)
    Provide a corresponding password.
  • contact [arg] (dict)
    Provide a dict object filled with contacts by the scheme contact_name : contact_email both as string.
  • smtpServer[arg] (str)
    Smpt server of the sender’s provider. Optional.
  • port[arg] (int)
    Provider port.

keyLogger

keyLogger(filepath=None, overwrite=False) [object]

Wrapped logger instance keyLogger(logger) which takes same kwargs. After calling method start() all key events will be logged to the file in filepath. The logger is by default detatched. To stop the logger, simply type killlogger.

 .  
  ()
.()

Оцените статью
Master Hi-technology
Добавить комментарий