Skip to main content

A logging package for your python project.

Project description

PyLogs

A logging package for your python project


Description

PyLogs allow you to add a logger to your python project. This logger can send the logs directly to the terminal and/or save them in an external file. Several options are available, such as :

  • format
  • type
  • more in coming...

If you need help, go on my GitHub

Work on python 3. For Windows, macOS and Linux.


Installation

You just need to run this command in your terminal :

Windows

py -m pip install --upgrade LogGrap

Linux

python3 -m pip install --upgrade LogGrap

Functions and Constant

A list of all functions and constant in this package.

pylogs.TYPE_NEUTRAL
pylogs.TYPE_INFO
pylogs.TYPE_WARN
pylogs.TYPE_ERROR
pylogs.TYPE_CRITICAL
pylogs.Logger(String : name, String : directory)

pylogs.Logger.getFormat(String (opt): type)
pylogs.Logger.setFormat(String : format, String (opt): type)

pylogs.Logger.setTerminalOutput(Boolean : terminalOutPut, String (opt): type)
pylogs.Logger.setFileOutput(Boolean : fileOutPut, String (opt): type)

pylogs.Logger.neutral(String : text)

pylogs.Logger.loggerPrint(String : type, String : text)

pylogs.Logger.info(String : text)
pylogs.Logger.warn(String : text)
pylogs.Logger.error(String : text)
pylogs.Logger.critical(String : text)

Exemple

An example of how to implement PyLogs to your projects

>>> import pylogs
>>> MyLogger = pylogs.Logger(name="MyLogger", directory="./logs")
>>> MyLogger.setFormat(pylogs.TYPE_INFO, " - [%hour] [%name] "
>>> MyLogger.info("Connected")

# Create a log file named with the date of your computer
# It contain the output
 - [11:08:50] [MyLogger] Connected

>>> MyLogger.fileOutput(False) # Turn off the file ouput for all logs
>>> MyLogger.neutral("A random message")
A random message

>>> MyLogger.fileOutput(TYPE_CRITICAL, True) # Turn on the file output for the critical messages
>>> MyLogger.terminalOutput(TYPE_CRITICAL, False)
>>> MyLogger.critical("critical error")

# The output will be in the logs file but not in the terminal (Only for the critical messages)

Credits

developed by ssomgrap

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

LogGrap-0.1.9.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

LogGrap-0.1.9-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file LogGrap-0.1.9.tar.gz.

File metadata

  • Download URL: LogGrap-0.1.9.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for LogGrap-0.1.9.tar.gz
Algorithm Hash digest
SHA256 b80799f16c3f00992be8ec433e96150f921a44d719258ea7aad65efb24f72b63
MD5 7134dc9a877743d87b7c01cb3f3a9153
BLAKE2b-256 6741fb21ff2c2d1a53c211c401517718db04d1c738dd4ff49f138309cbc38a72

See more details on using hashes here.

File details

Details for the file LogGrap-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: LogGrap-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for LogGrap-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 a81b486158e2fd1d68c00fe6d85a07203e40fc894559b491154061d2bc25d8d6
MD5 ae3918b63560dbacf043d9ce711521b3
BLAKE2b-256 944e5a5656343265903c3bff80c911656404a453e6ca0c13f60c8fe8f025e94c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page