This repository has been archived by the owner on Nov 15, 2021. It is now read-only.
Feature logging #90
Merged
localhuman
merged 7 commits into
CityOfZion:feature-events
from
metachris:feature-logging
Nov 18, 2017
Merged
Feature logging #90
localhuman
merged 7 commits into
CityOfZion:feature-events
from
metachris:feature-logging
Nov 18, 2017
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…) log messages in DEBUG
…ging * origin/feature-events: turn back on logging sc events by default catch error when trying to get script container Logging: configure through settings, enable logfile (#89)
This is, as always, a great addition! |
localhuman
pushed a commit
that referenced
this pull request
Nov 19, 2017
* events: first baby step * event hub update and requirement fix * feature-events: pycodestyle * feature-events: Runtime.Nofify payload always list of string * Runtime.Notify and Runtime.Log almost done * eventhub: docs update, notify always get list * start SmartContract dapp interface * fix stackitem.GetInterface * feature-events: EventHub and SmartContractEvent simplification * notify event dispatching changes * pep8 the changes * pep8 the changes * updating event dispatching * checking for errors * formatting * added testmode into events * changed how items are queried and deleted in DBCollection * removing unnecessary try / excepts * style fix * added deletenep5 token * style fix * moved SmartContract to contrib/ * InvokeContract: return wallet_tx instead of True * EventHub and SmartContract inline docs * replaced print with log statements * contrib/smartcontract: simplification, bugfix and docs * Logging: configure through settings, enable logfile (#89) * catch error when trying to get script container * turn back on logging sc events by default * Feature logging (#90) * Logging: configure through settings, enable logfile * Update all __log and print statements to new logger system * move default log level to INFO, and only have certain (often-occuring) log messages in DEBUG * Fixes * UserWallet: logger.info -> logger.error + logger.debug * UserWallet pep8 fix
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What current issue(s) does this address?, or what feature is it adding?
This is a big one. Basically replaced all
print
and__log
statements withlogger.info
, and the internalNeoNode
and a few other very verbose and often occuring ones withlogger.debug
. Just inneo.Prompt.*
the original print statements were left, because they are often used for user interaction.In prompy.py you can toggle:
config debug on/off
config sc-events on/off
Note: if you set the disable debug logging with
config debug off
, this also effects the logfile, since we are configuring and using the same logger for console and file handler.In Settings there is now:
set_log_smart_contract_events(..)
,set_logfile(..)
andset_loglevel(..)
with the default loglevel set tologging.INFO
initially.I also tried to change all error output and exceptions to
logger.error
andlogger.exception
.Lastly, I fixed an error that often occured for smart contracts here: https://github.com/CityOfZion/neo-python/compare/feature-events...metachris:feature-logging?expand=1#diff-af1e060838849446615e1242da849889R263
How did you solve this problem?
Lots of search and replace, and manual testing, and automatic testing.
How did you make sure your solution works?
The tests still work, and manual testing too.
Did you add any tests?
No
Did you check your
pycodestyle
?Yes
Are there any special changes in the code that we should be aware of?
...
Any log statement that should always be presented to the user should use at least the INFO loglevel (eg.
logger.info(...)
). Pure debug output that the user has to first enable should uselogger.debug(..)
.Are you making a PR to a feature branch or development rather than master?
feature-events