A simple logging package that helps you to log what is happening in your application.
Project description
Log and Print
A simple logging package that helps you to log what is happening in your application.
Installation
You can install Log and Print using pip:
pip install logandprint
Usage
To start logging it is as simple as importing the logandprint object and issuing the logging commands:
write, info, error, success, warning, debug
To logging a message to the log:
import logandprint as log
log.write("This is a common log message")
log.info("This is log information, it appears blue in the terminal")
log.error("This is an error message, it appears red in the terminal")
log.success("This is a success message, it appears green in the terminal")
log.warning("This is a warning message, it appears yellow in the terminal")
log.debug("This is a debug message, it appears white in the terminal")
The write, info, error, success, warning methods accept two parameters, the message and the console flag (boolean) to display or not the message in the terminal.
In the debub method, messages will only be displayed in the terminal if debug mode is active log.debugMode(True)
setLogFile
By default, the log is saved in the log.log file in the current directory. But you can change the log file by using the setLogFile function.
log.setLogFile("./logs/myLogFile.log")
debugMode
The log packet will not be printed to the console. You can change this by setting debugMode to True.
log.debugMode(True)
To stop printing to the console, change the debugMode setting to False. Don't worry, the log file will still be writing.
log.debugMode(False)
enable
To disable the log you can call the enable function and set it to False.
log.enable(False)
And to enable it again you can call the enable function and set it to True.
log.enable(True)
export_to_csv
You can export the log to a csv file by calling the export_to_csv function.
log.export_to_csv("./logs/myLogFile.csv")
Author
- Guilherme Saldanha
Copyright
This software is free to use and distribute. You can use it for any purpose, but please give credit to the original author.
For more info see LICENSE file.
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
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 logandprint-1.2.3.tar.gz.
File metadata
- Download URL: logandprint-1.2.3.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4453a8f21878488fbb4157d739397216af2147e133a1ff06740e6eda4f6adb4
|
|
| MD5 |
5545f70cb0782fb02bb4afa0d10b6df5
|
|
| BLAKE2b-256 |
0f27c820f12f904b5133a4b998ebd68bb6181118687da1d88bfbf5e4081381ba
|
File details
Details for the file logandprint-1.2.3-py3-none-any.whl.
File metadata
- Download URL: logandprint-1.2.3-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0ab7c75271c065d91214b527bef161312a28c0f69da405ab171c5c88bb4c587
|
|
| MD5 |
2b0bd317bb103f977d43e9a959e0e6e7
|
|
| BLAKE2b-256 |
1f81dcb355078c119cd06a5b324ae2c18f451886f4c541f0f7194ed1daa0b18c
|