Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Basic logger for Python logging
module.
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" )
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()
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")
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))
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"
]
}
}
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
See the file LICENSE.txt
FAQs
Python Distribution Logger, Debugger and Utilities
We found that debug-tools demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.