Debug Tools
Basic logger for Python logging module.
Usage
pip install debug_tools
Or clone this repository locally by running the commands:
git clone https://github.com/evandrocoan/debugtools
cd debugtools
Then, run python setup.py install or python setup.py develop to install it on development mode.
from debug_tools import getLogger
# Enable debug messages: (bitwise)
# 0 - Disabled debugging.
# 1 - Basic logging messages.
# 2 - AgentPlayer class' notices.
# 4 - StickIntelligence class' notices.
# 127 - All debugging levels at the same time.
log = getLogger( 127, __name__ )
log( 1, "Debugging" )
Cleaning the log file every start up
If you are logging the debug output to a file and you would like to clean/erase all the log file contents, every time you re-create the logger, you need first to unlock the log file lock, otherwise, the file contents are not going to be erased.
To unlock your log file,
you just need to call log.setup(""),
with an empty string before creating a new logger.
On Sublime Text, this could be done with te following:
from debug_tools import getLogger
log = getLogger(debug_enabled, "wrap_plus", "wrapplus.txt", mode='w')
def plugin_unloaded():
log.delete()
Dynamically Reloading It
If you want to reload the debug tools code on the fly, you can use this to import it:
import imp
import debug_tools.logger
imp.reload( debug_tools.logger )
from debug_tools.logger import Debugger
from debug_tools.logger import getLogger
Debugger.deleteAllLoggers()
log = getLogger(1, "LSP")
Using file logger configuration
If you want to load the logger configuration from a file, you need to replace the standard logging module class with this one:
import logging
import debug_tools
if log_config:
with open(log_config, 'r') as f:
logging.Logger.manager = debug_tools.Debugger.manager
logging.Logger.manager.setLoggerClass( debug_tools.Debugger )
logging.config.dictConfig(json.load(f))
Sublime Text Dependency
To use this as a Package Control Dependency https://packagecontrol.io/docs/dependencies create
this dependencies.json file on the root of your Package:
{
"windows": {
">3000": [
"python-pywin32",
"portalockerfile",
"concurrentloghandler",
"debugtools"
]
},
"*": {
"*": [
"portalockerfile",
"concurrentloghandler",
"debugtools"
]
}
}
Update estimated_time_left from upstream
To update the subtree all/debug_tools/estimated_time_left,
from upstream updates you can use the command:
git subtree pull --prefix=all/debug_tools/estimated_time_left https://github.com/evandrocoan/EstimatedTimeLeft master
To send updates back to the upstream, use the following command:
git subtree push --prefix=all/debug_tools/estimated_time_left https://github.com/evandrocoan/EstimatedTimeLeft master
License
See the file LICENSE.txt
Metadata
Release files for debug-tools 2.6.20
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| debug_tools-2.6.20.tar.gz | 54.6 kB | Without provenance | Details |
Release files / debug_tools-2.6.20.tar.gz
| Download URL | debug_tools-2.6.20.tar.gz |
|---|---|
| Size | 54.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e1c15ef43ff00f816e79c280a731e5e64f1e6b3e69593e55f2336c41fc95b148
|
|
BLAKE2b-256 checksum How to use checksums |
9014583eb5a145b12bd1ae43a2005203ac36a138f8e18297ce995a8f5c1479c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.22.0 setuptools/42.0.2.post20191203 requests-toolbelt/0.8.0 tqdm/4.40.2 CPython/3.6.9
|
Security for debug-tools 2.6.20
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.